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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Select Top n and sorting

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-07-28 : 14:58:37
Ron writes "I have a table with a "Time" field and a "City" field. I need to create a view to sort this table by the "Time" field, select the Top 56 records from this table when sorted by "Time", and then sort the field by the "City" field.

I can create 2 views to accomplish this, but was looking for a cleaner way.

I’m running SQL Server 2000 on a Windows 2000 Server box."

LarsG
Constraint Violating Yak Guru

284 Posts

Posted - 2002-07-28 : 15:10:48
select * from (select top 56 * from t order by time desc)
order by city

Should it be order by time desc or order by time asc?

No clear from your question.

Go to Top of Page
   

- Advertisement -