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 |
beza
Starting Member
16 Posts |
Posted - 2009-02-26 : 09:37:54
|
I have a table with a userName and counter fieldsWhat I want to do is select the 20 record sets which have the biggest counters and then order those results by abc (userName will go by abc) I tried doing it with order by but I can't seem to do itCan anyone help ??Thanks a lot!! |
|
heavymind
Posting Yak Master
115 Posts |
Posted - 2009-02-26 : 09:55:22
|
please show us the query you already have...Thanks, VadymMCITP DBA 2005/2008Chief DBA at http://www.db-staff.com |
 |
|
beza
Starting Member
16 Posts |
Posted - 2009-02-26 : 10:06:06
|
my query goes like thisSELECT TOP 10 Users.UsersName, Users.Counter FROM Users ORDER BY Counter DESC, UsersName ASCI want to select from table users, the userName and counterordered by counter first and than order those resuls by abcfor exampleUserName Countera 1b 2c 3d 4when I select top 2 I will getc and afterwards dThanks a lot for you help |
 |
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-02-26 : 10:12:08
|
Your query looks ok to me. Whats the output you are getting ? |
 |
|
beza
Starting Member
16 Posts |
Posted - 2009-02-26 : 10:24:16
|
I get it sorted only by abcand I have no idea whyI need to select TOP 10 records ordered by counter and then do some kind of inner sort for those 10 recordsThank for you help |
 |
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-02-26 : 11:24:43
|
Maybe clear if you post sample data and expected output? |
 |
|
beza
Starting Member
16 Posts |
Posted - 2009-02-26 : 19:34:35
|
I did!look 2 posts aboveThanks |
 |
|
|
|
|