Error in using YEAR function in SQL Worksheet

Answered

Comments

2 comments

  • Rick Pack

    Here was the solution. I appear to have been hitting a reserved keyword problem and / or needed the YEAR function in the GROUP BY clause, per Stack Overflow responder, Tim Biegeleisen.

    SELECT YEAR(draw_date) AS yr, COUNT(*) AS cnt
    FROM rslt_part
    GROUP BY YEAR(draw_date)
    0
    Comment actions Permalink
  • Alan Mark

    Hi Rick,

    You're correct, YEAR is a reserved word.  You can find information about using reserved words as well as a link to Microsoft's documentation for the Transact-SQL specification we follow here:

    https://documentation.datameer.com/documentation/display/DAS70/SQL+Worksheet#SQLWorksheet-reservedUsingreservedSQLkeywords

    If you have any further questions, don't hesitate to ask!

    2
    Comment actions Permalink

Please sign in to leave a comment.