Board index » delphi » How to sort order in SELECT by ascending/descending order for MS SQL

How to sort order in SELECT by ascending/descending order for MS SQL

I am trying to get an ORDER BY result in my SELECT but I don't seem to
find any docs on how you can get the result in ascending or descending
order. I would like my result that has a datetime value to be highest
first and lowest last. How can I do this?

Thanks
Andrew

 

Re:How to sort order in SELECT by ascending/descending order for MS SQL


Use the ORDER BY clause with the field name and the keyword ASC (for
ascending) or DESC (for descending). ASC is default. You would
probably want to use "ORDER BY DateTimeField DESC;"
Jason Swager

On Thu, 08 Oct 1998 03:24:49 GMT, aadi...@ix.netcom.com (Andrew Diabo)
wrote:

Quote
>I am trying to get an ORDER BY result in my SELECT but I don't seem to
>find any docs on how you can get the result in ascending or descending
>order. I would like my result that has a datetime value to be highest
>first and lowest last. How can I do this?

>Thanks
>Andrew

Re:How to sort order in SELECT by ascending/descending order for MS SQL


Thanks Jason,

Its greatly appreciated.

Andrew

On Thu, 08 Oct 1998 04:20:46 GMT, jswa...@alohaoi.com (Jason Swager)
wrote:

Quote
>Use the ORDER BY clause with the field name and the keyword ASC (for
>ascending) or DESC (for descending). ASC is default. You would
>probably want to use "ORDER BY DateTimeField DESC;"
>Jason Swager

>On Thu, 08 Oct 1998 03:24:49 GMT, aadi...@ix.netcom.com (Andrew Diabo)
>wrote:

>>I am trying to get an ORDER BY result in my SELECT but I don't seem to
>>find any docs on how you can get the result in ascending or descending
>>order. I would like my result that has a datetime value to be highest
>>first and lowest last. How can I do this?

>>Thanks
>>Andrew

Other Threads