title: Fetch data from database in a specific order
body: <p>I have a table named vendor here is a view of it</p>
  
  <pre><code>id  vendorname   staffpick   totalfav
  1      V1           yes        1
  2      V2           yes        3
  3      V3           yes        4
  4      V4                      2
  5      V5                      5
  6      D
  7      A
  </code></pre>
  
  <p>I wish to create a list of vendors in the following order (no repetition of vendors)
  First those vendors should come whose value of staffpick is yes and these staffpick vendors should be arranged in dec order of totalfav value.
  Then those vendors should come who have totalfav but staffpick value is not yes.
  The last part comes where those vendors will be displayed who are neither staffpick nor totalfav and these vendors should be arranged in alphabatic order</p>
  
  <p>The list should be like this</p>
  
  <pre><code>V3
  V2
  V1
  V5
  V4
  A
  D
  </code></pre>
  
  <p>if I try to create an array for every part like this I get a repetition</p>
  
  <pre><code>SELECT * FROM  vendors where staffpick='yes' and favvendor!=''
  </code></pre>
  
  <p>can anyone tell how I can do the sorting</p>