I have a table with columns similar below but with approximately 30 date columns and over 500 records
id | forcast_date | actual_date 1 10/01/2013 12/01/2013 2 03/01/2013 06/01/2013 3 05/01/2013 05/01/2013 4 10/01/2013 09/01/2013
and I need to make a query with a result similar to
week_no | count_forcast | count_actual 1 4 6 2 5 7 3 2 1
etc.
My request
SELECT weekofyear(forcast_date) as week_num, COUNT(forcast_date) AS count_forcast , COUNT(actual_date) AS count_actual FROM table GROUP BY week_num
but what i get is forcast_date numbers repeating in each column i.e.
week_no | count_forcast | count_actual 1 4 4 2 5 5 3 2 2
Can someone tell me the best way to formulate a request in order to get what I need?
thanks
source share