Home > Microsoft SQL Server > Retrieve Records In Reverse Order

Retrieve Records In Reverse Order



I would like to get the records out starting with the last in first and so on. Is there a way to do that with using Order By.<br><br>My select statement is as follows:<br><br><div class="msgQuoteWrap"><div class="msgCode">SQL = "select * from DiscussionTopicComment Where ComboHex = '" & GetRecordNumber & "'"</div></div><br><br>I just want to reverse the order I do not want to Order them on any on field.<br><br>Thanks<br>Nevyn

    
Guest


I would add DESC on the end of the SQL DESC = Desending order.<br>It will look like this after:<br>SQL = "select * from DiscussionTopicComment Where ComboHex = '" & GetRecordNumber & "' DESC"

Was this answer helpful ? Yes No   
Guest


I tried your suggestion but it does not work. Thanks for trying<br><br>Nevyn

Was this answer helpful ? Yes No   
Guest


DECS works when used after an ORDER BY.

Was this answer helpful ? Yes No   
Guest


Ya - as Draiken said, you need to use ORDER BY first. This is needed to let the db know which column to use to do the sorting:


Code:



SELECT column,column,column FROM some_table WHERE somthing = something ORDER BY column DESC



Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved