Wednesday, October 10, 2018

I Hate Asking SQL Questions To Which I Used to Know the Answer

SELECT COUNT(ID) AS IncidentsByDecade, SUM('dead victim count') AS DeadByDecade FROM TABLE 'MassMurder' GROUP BY 'year';
What's the syntax error?  And is there a way to GROUP BY year/10?  Or do I need to create a separate field of decade calculated from the year field?

1 comment:

  1. SELECT COUNT(ID) AS IncidentsByDecade, SUM('dead victim count') AS DeadByDecade FROM TABLE 'MassMurder' GROUP BY 'year';

    should be

    SELECT COUNT(ID) AS IncidentsByDecade, SUM('dead victim count') AS DeadByDecade FROM 'MassMurder' GROUP BY 'year';

    ReplyDelete