I’ve got a sql query (using Firebird as the RDBMS) in which I need to order the results by a field, EDITION. I need to order by the contents of the field, however. i.e. ‘NE’ goes first, ‘OE’ goes second, ‘OP’ goes third, and blanks go last. Unfortunately, I don’t have a clue how this could be accomplished. All I’ve ever done is ORDER BY [FIELD] ASC/DESC and nothing else.
Any suggestions?
Edit: I really should clarify: I was just hoping to learn more here. I have it now that I just have multiple select statements defining which to show first. The query is rather large and I was really hoping to learn possibly a more effecient way of doing this: example:
SELECT * FROM RETAIL WHERE MTITLE LIKE 'somethi%' AND EDITION='NE' UNION SELECT * FROM RETAIL WHERE MTITLE LIKE 'somethi%' AND EDITION='OE' UNION SELECT * FROM RETAIL WHERE MTITLE LIKE 'somethi%' AND EDITION='OP' UNION (etc...)
1 Answer