>> I've got data in a table containing timestamps in a timestamp column. I >> want to group these by month. >> >> How? >> >> Anything simpler/better than this: >> substring(cast(T."TheTimestamp" as varchar(50)) from 1 for 7) > >select > count(*) > , extract(month from mytimestamp) >from > t >group by > extract(month from mytimestamp)
Or, if you don't want to group November 2010 with November 2011: select count(*) , extract(year from mytimestamp) || '-' || extract(month from mytimestamp) as MyMonth from t group by 2, 3 HTH, Set