Re: [sqlite] Group by Literals

2017-05-24 Thread David Raymond
dcalf Sent: Wednesday, May 24, 2017 1:22 PM To: SQLite mailing list Subject: Re: [sqlite] Group by Literals This means that you can do things like: SELECT a, b, max(c) FROM t GROUP BY a; And you will be returned the groups of values of a, the max value of c in that group, and the value of b

Re: [sqlite] Group by Literals

2017-05-24 Thread Keith Medcalf
On Wednesday, 24 May, 2017 06:07, Denis Burke wrote: > These all produce a single row of output (and it happens to be the last > row > inserted [a1,b5]): > select c1,c2 from t1 group by '1'; > select c1,c2 from t1 group by '2'; > select c1,c2 from t1 group by '3'; > select

Re: [sqlite] Group by Literals

2017-05-24 Thread R Smith
Apologies for the multiple posts, but having now read the documentation thoroughly, I think the OP has a point and the GROUP BY documentation can benefit from local inclusion of the integer constant explanation that is given later for ORDER-BY (as quoted below) - or perhaps simply

Re: [sqlite] Group by Literals

2017-05-24 Thread Hick Gunter
list. -Ursprüngliche Nachricht- Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im Auftrag von Denis Burke Gesendet: Mittwoch, 24. Mai 2017 14:07 An: SQLite mailing list <sqlite-users@mailinglists.sqlite.org> Betreff: [sqlite] Group by Literals The

Re: [sqlite] Group by Literals

2017-05-24 Thread R Smith
Just realized, the section I've quoted from ORDER BY, not GROUP BY, but the effect pertains the both. On 2017/05/24 2:38 PM, R Smith wrote: This is quite clear in the documentation I think, and might even be made clear in the SQL standard (but I did not check). An integer literal (and only

Re: [sqlite] Group by Literals

2017-05-24 Thread Clemens Ladisch
Denis Burke wrote: > The SQLite documentation (http://www.sqlite.org/lang_select.html) says the > GROUP BY clause accepts [expr]. And [expr] can be composed of a literal. > What I cannot find is what SQLite does (or should do) with a literal in the > GROUP BY clause. SQL-92 doesn't allow it: |

Re: [sqlite] Group by Literals

2017-05-24 Thread R Smith
This is quite clear in the documentation I think, and might even be made clear in the SQL standard (but I did not check). An integer literal (and only an integer literal) denotes the column number to order or group by. This is true for all Databases I know of, but that list is obviously not

[sqlite] Group by Literals

2017-05-24 Thread Denis Burke
The SQLite documentation (http://www.sqlite.org/lang_select.html) says the GROUP BY clause accepts [expr]. And [expr] can be composed of a literal. What I cannot find is what SQLite does (or should do) with a literal in the GROUP BY clause. In the simple case of table T1 with two columns C1,C2