A query for Report
| From: | Manuel | Date: | Fri, 08 Sep 2000 18:12:50 +0000 |
| Subject: | A query for Report | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-2769@lists.php.net to get a copy of this message | ||
Hope someone can help me with this query.
I want to create a query with this result, salesman sales count for the past xx months.
Jan Feb Mar etc Total
salesman 1 XX XX XX XXX
salesman 2 XX XX XX XXX
etc
Total XXX XXX XXX
XX - count
sales Table
***********
salesmancode
salesdate
I use this to get the individual total but I do not know how to group them into last xx months and the totals.
select salemancode,count(*) from sales group by salesmancode
Total
salesman 1 xx
salesman 1 xx
My problem:
1. How to split them into months?
2. How to total them up by Months(Jan, Feb, etc) and by Salesman (Salesman 1, Salesman 2, etc)?
Any idea/suggestion will be greatly appreciated.