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 | 253 2006-02-02 00:00:00 | 245 2006-02-03 00:00:00 | 231 2006-02-04 00:00:00 | 313 2006-02-05 00:00:00 | 285 2006-02-06 00:00:00 | 194 2006-02-07 00:00:00 | 229 2006-02-08 00:00:00 | 239 2006-02-09 00:00:00 | 250 2006-02-10 00:00:00 | 245 2006-02-11 00:00:00 | 275 Is there a way to eliminate the ugly repeated use of date_trunc('day',endtime)? ---------------------------(end of broadcast)--------------------------- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly