Re: [SQL] group by function, make SQL cleaner?

2006-04-03 Thread Bryce Nesbitt
Bryce Nesbitt wrote: Tom Lane wrote: In this particular case you could say ... GROUP BY 1 ORDER BY 1; ORDER BY n as a reference to the n'th SELECT output column is in the SQL92 spec. (IIRC they removed it in SQL99, but we still support it, and I think most other DBMSes do too.)

Re: [SQL] group by function, make SQL cleaner?

2006-03-18 Thread Stefan Becker
this should work, # SELECT date_trunc('day',endtime),count(*) FROM eg_event where endtime = '2006-02-01' and endtime '2006-03-01' GROUP BY 1 ORDER BY 1; best regards, Stefan Am Donnerstag, 16. März 2006 06:18 schrieb Bryce Nesbitt: I've got a working query: stage=# SELECT

Re: [SQL] group by function, make SQL cleaner?

2006-03-16 Thread Bryce Nesbitt
Tom Lane wrote: In this particular case you could say ... GROUP BY 1 ORDER BY 1; "ORDER BY n" as a reference to the n'th SELECT output column is in the SQL92 spec. (IIRC they removed it in SQL99, but we still support it, and I think most other DBMSes do too.) "GROUP BY n" is *not* in

Re: [SQL] group by function, make SQL cleaner?

2006-03-16 Thread pgsql
this should work, # SELECT date_trunc('day',endtime),count(*) FROM eg_event where endtime = '2006-02-01' and endtime '2006-03-01' GROUP BY 1 ORDER BY 1; hope this helps best regards, Stefan Am Donnerstag, 16. März 2006 06:18 schrieb Bryce Nesbitt: I've got a working query:

[SQL] group by function, make SQL cleaner?

2006-03-15 Thread Bryce Nesbitt
I've got a working query: stage=# SELECT date_trunc('day',endtime),count(*) FROM eg_event where endtime = '2006-02-01' and endtime '2006-03-01' GROUP BY date_trunc('day',endtime) ORDER BY date_trunc('day',endtime); date_trunc | count -+--- 2006-02-01 00:00:00

Re: [SQL] group by function, make SQL cleaner?

2006-03-15 Thread Tom Lane
Bryce Nesbitt [EMAIL PROTECTED] writes: SELECT date_trunc('day',endtime),count(*) FROM eg_event where endtime = '2006-02-01' and endtime '2006-03-01' GROUP BY date_trunc('day',endtime) ORDER BY date_trunc('day',endtime); Is there a way to eliminate the ugly repeated use of