September 24, 2010 at 9:48 am
Here is the results i get
ABCD EF G H I J
1aN1,0530 792 726 241
1aN1,05324 792 726 241
2bY04009092010 219 220 1,019
2bY0471409092010 219 220 1,019
3cN6530 3,935 4,493 2,293
3cN65312 3,935 4,493 2,293
WANT TO ELIMINATE DUPLICATES AND DESIRED LIKE THIS
ABCD EF G H I J
1aN1,05324 792 726 241
2bY0471409092010 219 220 1,019
3cN65312 3,935 4,493 2,293
September 24, 2010 at 9:57 am
Try to help us help by posting some table definitions and sample data.
Taking a stab in the dark there are no duplicates.
These two rows are unique.
3 c N 653 0 3,935 4,493 2,293
3 c N 653 12 3,935 4,493 2,293
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
September 24, 2010 at 10:00 am
i want the one which has the values on all rows
3 c N 653 12 3,935 4,493 2,293
September 24, 2010 at 10:05 am
They do all have values. Without some tables and some data there is next to nothing anyone can do to help.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
September 24, 2010 at 12:54 pm
select max(E) as E
,max(F) as F
,max(G) as G
,max(H) as H
,max(I) as I
,max(J) as J
from whateveryourtableis
group by A,B,C,D
I hope they have words like please and thank you in your native language.
I believe you meant to say you want rows with values in all columns.
I agree that zero *is* a value.
The above code should render the result you expect, but we could get the same result several different ways based on the data you provide. For example, we could have just filtered out rows with a zero in any column.
What result would you expect if two rows looked like this ?
A B C D E F G H I
1 1 1 1 0 1 1 1 1
1 1 1 1 1 0 1 1 1
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply