Friday, March 23, 2012

query urgent

my table is:

col1 col2 col3 col4 col5 col6
IT3 njfghj 0 0 0 Blue
IT3 njfghj 0 0 Simple 0
IT3 njfghj 0 35 0 0
IT3 njfghj Lee 0 0 0

i want the result as

col1 col2 col3 col4 col5 col6
IT3 njfghj Lee 35 Simple Blue

how is this posible??Try something like this:

SELECT Col1, Col2, MAX(Col3) AS Col3, MAX(Col4) AS Col4, MAX(Col5) AS Col5, MAX(Col6) AS Col6
FROM TableName
GROUP BY Col1, Col2

Regards,
Thomas

No comments:

Post a Comment