Hi!

Luke> Description:
Luke> 
Luke> I have a table full of pages for a church website I am developing.  Each has
Luke> some data (text) and a title, page id, updated (date) and created(date).  I
Luke> want to select a list of pages with their id and title and updated date
Luke> according to when they were created (by created).  When I select the id,
Luke> title, and updated date and sort by created, it displays the order wrong.
Luke> When I also tell it to select created, then it does it correctly.

mysql> SELECT pID, title, updated FROM pages WHERE category = '41' AND pID
<> '' AND isCategory = 'n' AND isArchived = 'n' ORDER BY 'created';

The reason the above is NOT sorted correctly is that you have quotes
around the 'created';  This means that you are sorting all
rows according to the constant string 'created.

Fix:

Change 'created' to created

Regards,
Monty



---------------------------------------------------------------------
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