title: Using CASE in PostgreSQL to SELECT different FROMs
body: <p>I'll try to create a query where the result can be from two different tables depending on the size of the first table.
  Is something comparable even possible?</p>
  
  <pre><code>SELECT 
      CASE WHEN COUNT(table1.column1) &gt; 5
      THEN
          column1,
          column2,
          column3
          FROM table1
      ELSE
          column1,
          column2,
          column3
          FROM table2
      END
  </code></pre>
  
  <p>With this code I got something like this:</p>
  
  <pre><code>ERROR:  syntax error at or near ","
  LINE 4:   column1, 
  </code></pre>