NoviceMe
10-14-2004, 09:13 AM
Hi,
I am working with SQL Anywhere, and am trying to produce a summary of results with the following:
[vb
SELECT team_id, monthname(date_of_event),
SUM (total_staff), SUM (total_hours),
SUM (outcomes1), SUM (outcomes2),
SUM (outcomes3)
FROM event_results
WHERE year(date_of_event) = 2003
GROUP BY team_id, date_of_event;
/vb]
It returns something that looks like this
AT1-01 August 2 8
AT1-01 August 2 8
AT1-01 August 4 32
AT1-01 September 2 8
AT1-01 September 2 8
AT1-01 October 4 32
AT1-01 October 3 24
AT1-02 October 3 27
I want it to produce proper totals by team and by month like so:
AT1-01 August 8 48
AT1-01 September 12 64
AT1-01 October 4 32
AT1-02 October 10 83
what is missing from my query? I am afraid I am a total beginner with SQL :)
Thanks in advance
I am working with SQL Anywhere, and am trying to produce a summary of results with the following:
[vb
SELECT team_id, monthname(date_of_event),
SUM (total_staff), SUM (total_hours),
SUM (outcomes1), SUM (outcomes2),
SUM (outcomes3)
FROM event_results
WHERE year(date_of_event) = 2003
GROUP BY team_id, date_of_event;
/vb]
It returns something that looks like this
AT1-01 August 2 8
AT1-01 August 2 8
AT1-01 August 4 32
AT1-01 September 2 8
AT1-01 September 2 8
AT1-01 October 4 32
AT1-01 October 3 24
AT1-02 October 3 27
I want it to produce proper totals by team and by month like so:
AT1-01 August 8 48
AT1-01 September 12 64
AT1-01 October 4 32
AT1-02 October 10 83
what is missing from my query? I am afraid I am a total beginner with SQL :)
Thanks in advance