I have a query like this:
SELECT * FROM blah1 WHERE blah2 ORDERBY %s
where I substitute a (sanitized!) string for %s. The problem is, the string might be empty. How do I insert a no-op in there if the string is empty, instead of changing the rest of the query?
I think it should work for you:
ORDER BY NULL