Export to GitHub

squiggle-sql - issue #2

SelectQuery does not support GROUP BY or HAVING clauses


Posted on Oct 1, 2008 by Quick Hippo

It would be nice if SqlQuery supported GROUP BY. This cannot be implemented by extending SqlQuery because the grouping criteria must appear before ordering.

Comment #1

Posted on Oct 1, 2008 by Quick Hippo

Comment deleted

Comment #2

Posted on Oct 1, 2008 by Quick Hippo

Comment deleted

Comment #3

Posted on May 30, 2010 by Quick Giraffe

Hi, I wrote a class GroupedSelectQuery which extends original SelectQuery to support GROUP BY and HAVING. Codes can be found on http://gist.github.com/419129 .

Also, I need some query statements like "SELECT COUNT(ip) AS count" but existing FunctionCall does not support this feature. So I wrote a class FunctionCallAsColumn which extends FunctionCall to support the AS . Codes can be found on http://gist.github.com/419129 , too.

The class SelectQuery is hard to extend since many important fields/methods are private. Hence the superclass which extends SelectQuery can not using them directly (For overriding the write(Output) method). I hope authors can make those fields/methods be protected instead of private, and then other users can extends SelectQuery without pain.

Comment #4

Posted on Aug 6, 2010 by Helpful Giraffe

In the issue #15 I've submitted a patch for supporting aliases in all Selectable implementations. This cover columns, literal, function calls (your case), etc...

Status: New

Labels:
Type-Enhancement Priority-High