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
https://forums.phpfreaks.com/topic/68050-solved-query-not-ordering-results/
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 :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.