SQL AST - group by fixes