Jump to content

[SOLVED] Query not ordering results


CptnChainsaw

Recommended Posts

Hi all, I'm trying to list phone calls in the order of priority.  My 'callback' field is of type 'datetime'.  My order by clause isn't making any difference.  I need the data ordered by date and time.

 

Any ideas what's wrong with this:

 

SELECT id, companyname, contactname, tel, DATE_FORMAT(callback, '%e/%c/%Y %l:%i %p') AS callback FROM companies WHERE callback > 0 ORDER BY callback ASC

 

 

Thanks in advance.

 

CptnChainsaw :)

Link to comment
Share on other sites

I agree it should've worked straight away as I'm using a datetime field type.  However it just didn't order the results.  Calling the function to explicitely convert to a date type did the trick  - not sure why though.  I wasn't getting any errors it just didn't produce the correct results.

 

Thnks for your replies btw

 

CC :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.