title: Problems with using EXISTS in SELECT clause on DB2
body: <p>I have a little problem with using EXISTS statement in the SELECT clause. I have tables ITEM and SUBITEM and I want to return the boolean flag if there exists any subitem of given type:</p>
  
  <pre><code>SELECT item.id, item.f1, item.f2, item.f3,
      EXISTS(select sub.id from schema.subitem sub where sub.item_id = item.id
        AND type='standard') as has_standard
      FROM schema.item item
  </code></pre>
  
  <p>However, I get the error message:</p>
  
  <blockquote>
    <p>Error: [IBM][CLI Driver][DB2] SQL0104N  An unexpected token "." was
    found following ".".  Expected tokens may include:  ", )". 
    SQLSTATE=42601 SQLState:  42601 ErrorCode: -104</p>
  </blockquote>
  
  <p>The example is simplified and the table names are not real, it's just an example to ask for the syntax for EXISTS clause on DB2. As far as I remember, I had no problems using that syntax on PostgreSQL or Oracle...</p>