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 |
lsy
Yak Posting Veteran
57 Posts |
Posted - 2005-09-13 : 20:42:29
|
can i query the top 10 value in database using sql statement??i had a series of data... which i just want the top 10 largest value to be display...pls advice...eg:counterA 6 115 3 12 7 10 2 89i want it return ascounterA1211109876543 |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2005-09-13 : 21:15:49
|
SELECT TOP 10 CouterA FROM myTable ORDER BY CounterA DESC |
 |
|
lsy
Yak Posting Veteran
57 Posts |
Posted - 2005-09-14 : 04:59:21
|
if i have more than 10 record with the largest value it will show it as well then how can i control it?? which i just want 10 records...eg:counter a121212121212121212121212 |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-09-14 : 05:09:15
|
SELECT TOP 10 CouterA FROM yourTable GROUP BY CounterA ORDER BY CounterA DESCorSELECT DISTINCT TOP 10 CouterA FROM yourTable ORDER BY CounterA DESCMadhivananFailing to plan is Planning to fail |
 |
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2005-09-14 : 05:11:52
|
SELECT distinct TOP 10 CounterA FROM yourTable ORDER BY CounterA DESC |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-09-14 : 05:14:19
|
Well AndrewJust now I edited my reply MadhivananFailing to plan is Planning to fail |
 |
|
lsy
Yak Posting Veteran
57 Posts |
Posted - 2005-09-14 : 05:42:13
|
thanks all... |
 |
|
|
|
|