|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Group by question
salesrep | dollars | months
a1 | $1.00 | 4/1/2004 a1 | $2.00 | 5/2/2004 a1 | $3.00 | 5/3/2004 a1 | $4.00 | 6/4/2004 a1 | $5.00 | 6/5/2004 a1 | $6.00 | 6/6/2004 b1 | $7.00 | 3/7/2004 b1 | $8.00 | 3/8/2004 b1 | $9.00 | 4/9/2004 b1 | $10.00 | 5/10/2004 b1 | $11.00 | 5/11/2004 b1 | $12.00 | 6/12/2004 b1 | $13.00 | 6/13/2004 Given the above data, I need to come up with a report that displays atotal by salesrep by month. Any help would be greatly appreciated. Getting a total by month is where I'm hung up.
__________________
_________________________ Dual Intel P3 1ghz CPU's ABIT VP6 dual FC-PGA 720,896mb ECC PC100 RAM 128meg ATI Radeon 9500 Pro Antec Performance II White Box Linux r3.0 kernel 2.4.21-9.0.3ELsmp |
|
#2
|
|||
|
|||
|
Try this:
SELECT salesrep, DATENAME(month, months) As MonthName, SUM(dollars) FROM tblDeleteMe GROUP BY salesrep, DATENAME(month, months) ORDER BY salesrep, DATENAME(month, months) Don't forget to substitute your table name for my tblDeletMe in the FROM clause. |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Group by question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|