Thread: group by date_part
HI, I have a table with some statistics and datetime field (data). I want select counted records by day of the week. select count (*) from stats group by date_part('dow',data::datetime_; I get everthing sortded just as I wanted to, but how can I ad another column to know which dow it is? eg: dow|count --------- 0 |123 4 | 322 ... mazek
M.Mazurek@poznan.multinet.pl writes: > select count (*) from stats group by date_part('dow',data::datetime_; > I get everthing sortded just as I wanted to, but how can I ad another > column to know which dow it is? select date_part('dow',data::datetime), count(*) from statsgroup by date_part('dow',data::datetime); regards, tom lane
On Sun, 20 Feb 2000, Tom Lane wrote: > select date_part('dow',data::datetime), count(*) from stats > group by date_part('dow',data::datetime); thx, i think i got the idea:) mazek