SQL query aggregate data for week - db2 ver7
Posted on 2006-04-10
I wanted to run a query to calculate peak per week from a table that has date time value column and the table has data for a day, I wanted to aggregate on that data for a week and find the peak value.
date time field is looking like this For Apr1 data 2006-04-01-00.00.00 starting to 2006-04-30-23:59:00 to end.
I wanted to aggregate the value for a week like starting Apr1-7,8-14,15-22,23-30 on a number column (amount) and then find the peak value (I suppose we can use max ) and get the value in 1 SQL query.