title: How can I prioritize the maximum of multiple columns in SQLite
body: <p>I have a little issue with my SQLite query which I use in python. In my little test_table I got 4 columns: sys_id, aq, vq, off_id. If I search for example for off_id=7477310</p>
  
  <pre><code>SELECT * FROM test_db WHERE off_id="7477310"
  </code></pre>
  
  <p>I get results:</p>
  
  <pre><code>sys_id  aq  vq  off_id
  154803  50  40  7477310
  153355  30  30  7477310
  153455  50  40  7477310
  163455  20  40  7477310
  </code></pre>
  
  <p>But I would also like a direct comparsion by this priority (vq,aq,sys_id) so I tought I use <code>max</code>. So the goal is if one result has the highest vq it directly wins, if vq ar identicial with more than one row next is aq, if aq is higher direct win, and last is sys_id if vq and aq is the same sys_id the highest sys_id wins.</p>
  
  <p>Any ideas?</p>
  
  <p>Thanks a lot</p>