Casting Date datatype to Datetime (Year to Month)
Posted in 1999
Guys, I am building an aggregate table from a fact table with millions of rows. I require the aggregation to be for monthly periods. The fact table has a Date column which I would like to aggregate monthly. eg. Fact table; sale_id serial due_date date customer char... part char ... amount money ... quantity decimal ... ... <other columns> ... Aggregate Table; agg_id serial agg_period datetime(year to month) customer char ... part char ... amount money ... quantity decimal ... I wanted to write a query which would give me the sum of amount and quantity, grouping by customer, part, and the monthly period, to insert into the aggregate table. Thanks, Kire Kire Prostizenovski Business Analyst J Blackwood and Son Limited 13 Cooper Street Smithfield NSW 2164 Australia Phone +61 2 9203 0133 Fax +61 2 9203 0160