I'm sorry but I can't write your queries for you.
Look at: group-by-functions.html
It should explain how to write queries to retrieve data like you need.
You may also want to use Dynamic Web Charts, which can use dates to plot data over time. It writes those queries for you.