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
 Transact-SQL (2000)
 select top 10 ordered twice?

Author  Topic 

csufu
Starting Member

1 Post

Posted - 2002-02-22 : 11:57:47

i want to get the last 10 messages put into a database, but then output them in the order they we're put in the database.

for example

select top 10 messages from tblmessages order by datecreated desc
but then get the recordset in datecreated asc

any ideas?

Cheers

Paul.

jbkayne
Posting Yak Master

100 Posts

Posted - 2002-02-22 : 12:11:15
Use a derived table:

i.e.

select * from
(
select top 10 * from Customers
order by CompanyName desc
) as derived
order by CompanyName



Edited by - jbkayne on 02/22/2002 12:16:03
Go to Top of Page
   

- Advertisement -