This is supposed to be easy
I am trying to do a query to get a total monthly violatins by dept,
Why is this query not working?
select cast(datepart("m",accidentDate) as varchar)+'/'+ cast(datepart("yyyy",accidentDate) as varchar) as "Monthly violations", deptname,count(violationID) from violation;
the result we expect is:
01/2003 02/2003 03/2003 04/2003 etc
3 for dept1 3 for dept1 7 for dept1 1 fr dept1
1 for dept2 1 for dept2 1 for dept2 1 fr dept2
7 for dept3 7 for dept3 1 for dept3 0 fr dept3
Instead f getting this vaues abve, I am getting ike:
exampe 1 for dept1
1 for dept1
1 for dept1 etc
It is not getting me the summary total instead it is giving me the count one number at a time
I am trying to do a query to get a total monthly violatins by dept,
Why is this query not working?
select cast(datepart("m",accidentDate) as varchar)+'/'+ cast(datepart("yyyy",accidentDate) as varchar) as "Monthly violations", deptname,count(violationID) from violation;
the result we expect is:
01/2003 02/2003 03/2003 04/2003 etc
3 for dept1 3 for dept1 7 for dept1 1 fr dept1
1 for dept2 1 for dept2 1 for dept2 1 fr dept2
7 for dept3 7 for dept3 1 for dept3 0 fr dept3
Instead f getting this vaues abve, I am getting ike:
exampe 1 for dept1
1 for dept1
1 for dept1 etc
It is not getting me the summary total instead it is giving me the count one number at a time