title: checking if a value exists in another table within the SELECT clause
body: <p>I want to query names from table1 and also find if a name exists in table2. I have the following query but it doesn't seem to work. Any suggestions what I did wrong?</p>
  
  <pre><code>select A.name, 
         CASE WHEN A.name in (select B.name in table2 B)
         THEN 'common'
         ELSE 'not common'
         END
  
  from table1 A
  </code></pre>
  
  <p>Please note that I have to get "common" / "uncommon" from the select clause itself. I'm using postgres.</p>