How to order by one column in one table and another column in other table ,but in a single query? <p>I tried two queries which work fine individually:</p> <p>1) <code>select * from {disputeticket} ORDER BY {creationtime} ASC</code><br> The query is working , here FK=PK of CsTicketState (Column name=State)</p> <p>2) <code>select * from {CsTicketState} where order by {SEQUENCENUMBER} asc</code><br> This one also works, here PK(column name)</p> <p>I need to have both on a single query. Sequence number is 0,1,2</p> <p>I tried the below query but only the first part is getting sorted, not the second part.</p> <pre><code>select {dp:pk},{dp:ticketid},{dp:state},{cts:code},{cts:sequencenumber} from {disputeticket as dp join CsTicketState AS cts on {dp:state}={cts:pk}} ORDER BY {cts:sequencenumber},{dp:creationtime} ASC </code></pre>