eliminate duplicates and show the values on the columns for each non duplicate raws.

keplan used Ask the Experts™
I have excel source as below and the need to be summarized the result shown below.

Excel Source:
Col1 Col2 Col3 Col4 Col5 Col6  col7
1       abc   tt     null   88   9      null
1       abc   tt     2      null  null   null
1       abc   tt      null  null  null  null
3       fgt    hh    null   3      null  null
3      fgt     hh    2      null   1      null
4      kkl    jj       null  8      3       1
4      kkl    jj      3     null    null   null

so as the data set, the col1, col2, col3 need to eliminated it duplicates, what I require the result as below :

col1   col2  col3 col4  col5  col6  col7
1       abc   tt     2      3       9      null
3       fgt    hh    2      3       1     null
4      kkl    jj      3       8      3       1

please give me solution to this
thanks in advance

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Billing Engineer
Most Valuable Expert 2014
Top Expert 2009
somethinkg like :
select col1, col2, col3, max(col4), max(col5), max(col6), max(col7)
 from yourtable 
group by col1, col2

Open in new window

otherwise, you also might want to read: http://www.experts-exchange.com/A_3203.html
Check the link below:


You have to do the following:
SELECT  col1, col2, col3,
 SUM(col4) as col4,
 SUM(col5) as col5,
 SUM(col6) as col6
FROM tbl
GROUP BY col1, col2, col3

Open in new window


the answer is not enough
Guy Hengel [angelIII / a3]Billing Engineer
Most Valuable Expert 2014
Top Expert 2009

what was not enough? can you explain?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial