Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
sudha12345
Starting Member
47 Posts |
Posted - 2009-05-05 : 06:53:16
|
| is there any keyword to display unique values in a table other than DISTINCT.Sudhakar |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-05-05 : 06:55:50
|
| use row_number()can post some sample data and output required |
 |
|
|
malaytech2008
Yak Posting Veteran
95 Posts |
Posted - 2009-05-05 : 07:02:27
|
| That depending on the requirement. Please send sample data of your requirement.malay |
 |
|
|
sudha12345
Starting Member
47 Posts |
Posted - 2009-05-05 : 07:04:34
|
quote: Originally posted by bklr use row_number()can post some sample data and output required
the sample data is1000001 1000001 1 APTripple 11/13/2008 14:521000001 1000001 2 virgildevice00 11/12/2008 10:561000001 1000001 3 LN02103D 11/13/2008 14:481000001 1000001 4 Plum169 11/13/2008 14:511000001 1000001 5 Dual41 11/12/2008 13:001000001 1000001 6 dually135 11/13/2008 14:491000001 1000001 7 singlerefic173 11/12/2008 10:281000001 1000001 1 APTripple 11/13/2008 14:521000001 1000001 2 virgildevice00 11/12/2008 10:561000001 1000001 3 LN02103D 11/13/2008 14:481000001 1000001 4 Plum169 11/13/2008 14:511000001 1000001 5 Dual41 11/12/2008 13:001000001 1000001 6 dually135 11/13/2008 14:491000001 1000001 7 singlerefic173 11/12/2008 10:28the above has 14 rows in which first set is repeatedi want only the distinct data from the above.can you guide me how can we do it with row_number()Sudhakar |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-05-05 : 07:05:02
|
Why not DISTINCT?*curious* No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
malaytech2008
Yak Posting Veteran
95 Posts |
Posted - 2009-05-05 : 07:18:59
|
| Webfred is right. You can use DISTINCT. Or if don't want to use it you can use UNION also.Malay |
 |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2009-05-05 : 08:03:08
|
| You can use GROUP BY, i.e.,SELECT col1,col2,col3,col4FROM yourTableGROUP BY col1,col2,col3,col4Jim |
 |
|
|
|
|
|