Page 1 of 1

MYSql Order By Problem???

Posted: Wed Jun 17, 2009 12:14 pm
by mischievous
Hey guys I have a this query im trying to run and its not really working...

Code: Select all

SELECT * FROM menu_items WHERE parent = ? ORDER BY ORDER DESC
but it throws an error at me stating there is an error in my syntax... and anyway i try to make it work its not wanting to work correctly? Is it possible to use the WHERE clause with the order by? :banghead:


After posting this topic and placing my SQL statement in the code box I realized that SQL was interpreting my "order" field as another ORDER so, changed the name of the order field and walla it worked. No longer need help on this. Thanks though!

:crazy:

Re: MYSql Order By Problem???

Posted: Wed Jun 17, 2009 3:49 pm
by akuji36
Try this link:

http://www.webproworld.com/database-dis ... -desc.html

In the end the solution was to use:

mysql_query("SELECT distinct town_name FROM real_estate_listings ORDER BY table_id DESC LIMIT 4" , $linkID) or die("connection not made b");

"Distinct" used instead of where command.

ROD

:D