Help - Search - Members - Calendar
Full Version: SQL problem
Invision Power Services > Community Forums > Community Web Design and Coding
Stephen
I have a query

SQL
SELECT status.tid, status.id, status.description, types.description AS name FROM status LEFT JOIN types ON status.tid = types.id ORDER BY status.tid AND status.description


which works, however I don't want to order by the status.id

I want to order by types.description, however if I replace status.tid with that it doesn't order at all



If I replace it by name (because the query says to return the field as name) it says the field doesn't exist

Any ideas how to achieve what I want? I've attached a dump of the tables

<edit>Just realised that doesn't even work as intended
Joshua Jones
it appears that your table "status" is being shown as a command and not your table.

That could be an issue. What happens if you use 'status'
Stephen
Thats not the problem, thats just because PHPMyAdmin's SQL highlighter isn't fantastic.

Anyway got it working, was over complicating things, didn't need a join original.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.