Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Order by


Message #1 by "Matthew Lohr" <mlohr@t...> on Tue, 16 Jan 2001 14:06:17 -0500
I am doing a query against a database and I order my results by the date.  I

need to order it from newest to oldest how do I do this?



Message #2 by "Curtis F. Barnett" <cfb@s...> on Tue, 16 Jan 2001 13:18:44 -0600
Try "SELECT... ORDER BY DateField ASC" (It's ASC for Ascending and DESC for

descending order)



> -----Original Message-----

> From: Matthew Lohr [mailto:mlohr@t...]

> Sent: Tuesday, January 16, 2001 1:06 PM

> To: ASP Databases

> Subject: [asp_databases] Order by

>

>

> I am doing a query against a database and I order my results by

> the date.  I

> need to order it from newest to oldest how do I do this?

>

Message #3 by Imar Spaanjaars <Imar@S...> on Tue, 16 Jan 2001 20:14:39 +0100
Add "ORDER BY yourField DESC" to your sql statement, like this:



Dim sSQL

sSQL = "SELECT ID, Date, Description FROM yourTable WHERE ID < 2000 ORDER 

BY yourField DESC



I added the WHERE clause just for demonstration purposes; the ORDER BY can 

be used on other SQL statements as well.



Use ASC to sort ascending, or leave it out since it is the default anyway.



HtH



Imar







At 02:06 PM 1/16/2001 -0500, you wrote:

>I am doing a query against a database and I order my results by the date.  I

>need to order it from newest to oldest how do I do this?



Message #4 by =?iso-8859-1?Q?H=E5kan_Frennesson?= <hakan@c...> on Tue, 16 Jan 2001 20:36:52 +0100
Hi!



What kind of SQL reference book do you have? These trivial matters should be

covered in any "lightweight" guide to SQL.

Makes me think that we are a bit lazy, huh? I suggest you investigate this

link and read it through and later on get a proper reference to SQL.:

http://w3.one.net/~jhoffman/sqltut.htm



Hakan







-----Original Message-----

From: Matthew Lohr [mailto:mlohr@t...]

Sent: den 16 januari 2001 20:06

To: ASP Databases

Subject: [asp_databases] Order by



I am doing a query against a database and I order my results by the date.  I

need to order it from newest to oldest how do I do this?



Message #5 by John Pirkey <mailjohnny101@y...> on Tue, 16 Jan 2001 12:30:09 -0800 (PST)
try this:



SELECT blah blah blah FROM Table WHERE conditions ORDER BY DateField DESC



john



--- Matthew Lohr <mlohr@t...> wrote:

> I am doing a query against a database and I order my results by the date.  I

> need to order it from newest to oldest how do I do this?

> 

> 



---------------------------- 

John Pirkey 

MCSD 

John@S... 

http://www.stlvbug.org

Message #6 by "Wally Burfine" <oopconsultant@h...> on Tue, 16 Jan 2001 22:30:00 -0000
Order By fieldname asc



asc is ascending

desc is descending





>From: "Matthew Lohr" <mlohr@t...>

>Reply-To: "ASP Databases" <asp_databases@p...>

>To: "ASP Databases" <asp_databases@p...>

>Subject: [asp_databases] Order by

>Date: Tue, 16 Jan 2001 14:06:17 -0500

>

>I am doing a query against a database and I order my results by the date.  

>I

>need to order it from newest to oldest how do I do this?

>

Message #7 by "Matthew Lohr" <mlohr@t...> on Wed, 17 Jan 2001 07:45:28 -0500
I have no SQL reference books I have bought 6 other WROX books in the last 6

or so months.  I guess the next one needs to be SQL.  I just started

programming .  Well save for the basic and pascal i did in high school.  I

guess you can figure out how long agao they last taught that.



-----Original Message-----

From: Håkan Frennesson [mailto:hakan@c...]

Sent: Tuesday, January 16, 2001 2:37 PM

To: ASP Databases

Subject: [asp_databases] RE: Order by





Hi!



What kind of SQL reference book do you have? These trivial matters should be

covered in any "lightweight" guide to SQL.

Makes me think that we are a bit lazy, huh? I suggest you investigate this

link and read it through and later on get a proper reference to SQL.:

http://w3.one.net/~jhoffman/sqltut.htm



Hakan







-----Original Message-----

From: Matthew Lohr [mailto:mlohr@t...]

Sent: den 16 januari 2001 20:06

To: ASP Databases

Subject: [asp_databases] Order by



I am doing a query against a database and I order my results by the date.  I

need to order it from newest to oldest how do I do this?



Message #8 by "Ken Schaefer" <ken@a...> on Thu, 18 Jan 2001 13:09:17 +1100
But you've heard of this thing called "the internet" no?



Goto www.google.com and type in SQL Tutorial as your keywords.

Guess which is the first hit? w3.one.net/~jhoffman/sqltut.htm (which is the

one I've been pointing people to for donkeys years...it's been there for

about 5 years)



Cheers

Ken





----- Original Message -----

From: "Matthew Lohr" <mlohr@t...>

To: "ASP Databases" <asp_databases@p...>

Sent: Wednesday, January 17, 2001 11:45 PM

Subject: [asp_databases] RE: Order by





> I have no SQL reference books I have bought 6 other WROX books in the last

6

> or so months.  I guess the next one needs to be SQL.  I just started

> programming .  Well save for the basic and pascal i did in high school.  I

> guess you can figure out how long agao they last taught that.

>

> -----Original Message-----

> From: Håkan Frennesson [mailto:hakan@c...]

> Sent: Tuesday, January 16, 2001 2:37 PM

> To: ASP Databases

> Subject: [asp_databases] RE: Order by

>

>

> Hi!

>

> What kind of SQL reference book do you have? These trivial matters should

be

> covered in any "lightweight" guide to SQL.

> Makes me think that we are a bit lazy, huh? I suggest you investigate this

> link and read it through and later on get a proper reference to SQL.:

> http://w3.one.net/~jhoffman/sqltut.htm

>

> Hakan




  Return to Index