title: Conditional grouping clause (sqlite)
body: <p>Inside a <code>SELECT</code> statement, is it possible to <code>GROUP BY col_A</code> if <code>col_B = "some_value"</code>, otherwise <code>GROUP BY col_C</code> ? Then have that field that was used for grouping inside the results?</p>
  
  <p>Like</p>
  
  <pre><code>SELECT value_of_the_column_used_for_group 
     FROM table WHERE ... 
     GROUP BY (IF col_B = "some_value" : col_A : ELSE : col_C)
     LIMIT 0, 20;
  </code></pre>
  
  <p>Basically I want to select children records that have distinct parents or parent records that have distinct IDs. But I want to select parent IDs, which can be the ID column or the "parent_ID" column from children records</p>