title: Return true if all column values are true
body: <p>Is there a faster way in PostgreSQL to essentially do an if on several rows?</p>
  
  <p>Say I have a table</p>
  
  <pre><code>ticket | row | archived
  1      | 1   | true
  1      | 2   | true
  1      | 3   | true
  2      | 1   | false
  2      | 2   | true
  </code></pre>
  
  <p>Is there any way I could do an if statement across down the column where ticket = ?
  So that where ticket = 1 would be true because</p>
  
  <pre><code>true &amp;&amp; true &amp;&amp; true = true
  </code></pre>
  
  <p>and where ticket = 2 would be false because</p>
  
  <pre><code>false &amp;&amp; true = false
  </code></pre>
  
  <p>Or should I just stick with</p>
  
  <pre><code>SELECT ( (SELECT COUNT(*) FROM table WHERE ticket = 1)
         = (SELECT COUNT(*) FROM table WHERE ticket = 1 AND archived = true) )
  </code></pre>