anjumr06 / squiggle-sql

Automatically exported from code.google.com/p/squiggle-sql
0 stars 0 forks source link

SelectQuery does not support GROUP BY or HAVING clauses #2

Open GoogleCodeExporter opened 8 years ago

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

Original issue reported on code.google.com by nat.pr...@gmail.com on 1 Oct 2008 at 6:20

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
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.

Original comment by inthesea...@gmail.com on 30 May 2010 at 4:46

GoogleCodeExporter commented 8 years ago
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...

Original comment by brunoabdon on 6 Aug 2010 at 4:56