Solved $query Order BY ...
Posted: Fri Mar 18, 2011 8:05 pm
I have a query which I need to order by state but I just can't figure it out a simple thing.
Using a simple command works fine
but when changed to
It doesn't work. What m'I missing?
Thank you
Using a simple command works fine
Code: Select all
$query = 'SELECT b.*'.
' FROM #__my_cat a'.
' INNER JOIN #__items b'.
' on a.id_items = b.id '.
' where a.id_cat = '.$id.
' order by state = "WISCONSIN" DESC';
Code: Select all
$mystate = 'WISCONSIN';
$query = 'SELECT b.*'.
' FROM #__my_cat a'.
' INNER JOIN #__items b'.
' on a.id_items = b.id '.
' where a.id_cat = '.$id.
' order by state = $mystate DESC';
Thank you