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
 General SQL Server Forums
 New to SQL Server Programming
 problem in select command

Author  Topic 

pooya1072
Starting Member

13 Posts

Posted - 2013-03-16 : 19:57:17
hi
please look at this select command :
select top 2 * from dbo.NFFeeds order by id desc

for my database the result is 2 rows .first by id=33 and second by id=32
by this command i get two last rows from my table . how can i get this two rows like this :
first row by id=32 and second row by id=33

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-03-16 : 21:19:36
Do you mean this?
SELECT * FROM
( SELECT TOP 2 * FROM dbo.NFFeeds ORDER BY id DESC )
AS s ORDER BY id ASC;
Go to Top of Page

pooya1072
Starting Member

13 Posts

Posted - 2013-03-17 : 04:20:55
thank you very very much ... it's done
Go to Top of Page
   

- Advertisement -