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 |
shajimanjeri
Posting Yak Master
179 Posts |
Posted - 2007-10-04 : 03:46:01
|
Hi, How to write a query to get top 50 distinct records from a table.I mean I have a table 'C1_Subscribers' with a field name 'Nickname'. Here I need to select top 50 non-repeated nickname only.Can anybody can help me!! |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-10-04 : 03:48:24
|
TOP 50 ordered by what?SELECT DISTINCT TOP 50 NickNameFROM C1_Subscribers E 12°55'05.25"N 56°04'39.16" |
 |
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2007-10-04 : 03:53:10
|
This is one way:SELECT TOP 50 NickName GROUP BY NickNameJack Vamvas--------------------Search IT jobs from multiple sources- http://www.ITjobfeed.com/SQL |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-10-04 : 05:12:30
|
Top without order by doesnt make any sense until you want them randomother methodSet Rowcount 50Select querySet Rowcount 0MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|