Conditional ORDER BY
<p>I have a simple query. Something like this:</p>

<pre><code>SELECT
    id,
    item,
    action,
    desc,
    time
FROM t1
WHERE bus = 6
ORDER BY action DESC, time ASC
</code></pre>

<p>I need to modify ORDER BY part and only use <strong>action DESC</strong> if <strong>desc == ''</strong></p>

<p>Basically it will output results and sort them by time in ASC order and if there are any actions that do not have description will be pegged at the top. Is it possible to do in a single query? If yes, how do I incorporate it?</p>