title: select * from (select * from table)
body: <p>I have a table which records if a patron has a certain flag marked on its account. When the flag is marked it adds the flag to the patronflag table, i.e.</p>
  
  <pre><code>patronid   flagnumber   flagvalue
       123          200           1
  </code></pre>
  
  <p>The patron is not listed in the patronflag table if they have never had the flag.</p>
  
  <p>I using the following query to find patrons who have flag 1 and but not flag 2. What I am failing to figure out is how to get patronfirst and patronlast names so I can send out a report. patronid is the primarykey and patronfirst and patronlast are the fields.</p>
  
  <pre><code>select getpik(patronid) from
  (
  Select pf.patronid from patronflags pf, pers p where pf.patronid = p.id_pers and pf.flagnumber = '2'
  
  minus
  
  Select pf.patronid from patronflags pf, pers p where pf.patronid = p.id_pers and pf.flagnumber = '2'
  )
  </code></pre>