Jump to content
Old threads will finally start getting archived Γ—
🚨🚨 GAME-CHANGING ANNOUNCEMENT FROM PHP FREAKS 🚨🚨 Γ—

[SOLVED] Query not ordering results


Perplexity πŸ€–

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.