order by date_format(mydate,'yyyy-mm-dd') desc

-----Original Message-----
From: Carter, Scott [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 19, 2002 11:30 AM
To: 'Doug Durham'; '[EMAIL PROTECTED]'
Subject: RE: simple question


The problem is the command is not ordering in either direction.  The ORDER
BY clause does not seem to have any effect at all.  Maybe ORDER BY is not
the right solution.

If I want to return records sorted by a column of date type, how do I do
this?

Thanks - Scott Carter

-----Original Message-----
From: Doug Durham [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 19, 2002 11:59 AM
To: Carter, Scott
Subject: RE: simple question


Since the default ORDER BY is ascending, and you want the most recent
first, have you tried

...
ORDER BY lastused DESC

- Doug


At 11:37 AM 11/19/2002 -0600, you wrote:
>There might be ten different records with a fname of scott and the dates
>might be 2002-11-18, and 2002-11-10 and 2002-10-15.  When the query results
>are returned the ORDER BY clause seems to have no effect on the results.  I
>would want the record with the most current date to be returned first, then
>second most current date ...
>
>The question is really pretty simple, I just need to know how in MySQL can
I
>order my query results in chronilogical order based on a column of date
>type.  This is an application where  I write the date a user signs on into
>the database, and when the users are queryed I need to show the newest user
>first.
>
>Thanks - Scott Carter
>
>
>-----Original Message-----
>From: Paul DuBois [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, November 19, 2002 9:46 AM
>To: Carter, Scott; '[EMAIL PROTECTED]'
>Subject: RE: simple question
>
>
>At 9:06 -0600 11/19/02, Carter, Scott wrote:
> >The actual query is :
> >SELECT * FROM PROFILES WHERE fname="scott" ORDER BY lastused;
> >
> >The lastused field is of type date, and I want the returned result set to
>be
> >ordered by that date.
>
>Still need more info.  What dates are in the records with "scott" and
>in what order are they returned?
>
> >
> >Thanks - Scott Carter
> >
> >
> >-----Original Message-----
> >From: Paul DuBois [mailto:[EMAIL PROTECTED]]
> >Sent: Monday, November 18, 2002 5:51 PM
> >To: Carter, Scott; '[EMAIL PROTECTED]'
> >Subject: Re: simple question
> >
> >
> >At 17:19 -0600 11/18/02, Carter, Scott wrote:
> >>I want to sort my results by a date that is contained in the database
>table
> >>the query is performed on.  The ORDER BY clause does not seem to do the
> >>trick.  How do you do this?
> >>
> >>Thanks - Scott Carter
> >
> >With ORDER BY.  You'll have to provide more details so that we can
> >see what the problem is with your query.
>
>---------------------------------------------------------------------
>Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
>To request this thread, e-mail <[EMAIL PROTECTED]>
>To unsubscribe, e-mail
<[EMAIL PROTECTED]>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to