title: Grouping by Month of TimeStamp
body: <p>I am attempting to group by twice, once by an individual level field and then by the month of the timestamp field.</p>
  
  <p>Little new to SQL but here's what I came up with after reading another SO post here: <a href="https://stackoverflow.com/questions/18087659/sql-query-to-group-by-month-part-of-timestamp">SQL query to group by month part of timestamp</a></p>
  
  <pre><code>SELECT
          VwNIMUserDim.USER_EMAIL_ADDRESS,
           VwNIMEventFct.NIM_USER_ID, 
           SUM(CASE WHEN NIM_EVENT_TYPE_ID = 880 THEN 1 ELSE 0 END) AS APP_OPEN,
           SUM(CASE WHEN NIM_EVENT_TYPE_ID = 881 THEN 1 ELSE 0 END) AS AUTODL_SETTINGS_SAVE,
           SUM(CASE WHEN NIM_EVENT_TYPE_ID = 882 THEN 1 ELSE 0 END) AS AUTO_QUERY_CONFIRM,
           SUM(CASE WHEN NIM_EVENT_TYPE_ID = 883 THEN 1 ELSE 0 END) AS ISSUE_CLOSE,
           SUM(CASE WHEN NIM_EVENT_TYPE_ID = 884 THEN 1 ELSE 0 END) AS ISSUE_DOWNLOAD,
           SUM(CASE WHEN NIM_EVENT_TYPE_ID = 885 THEN 1 ELSE 0 END) AS ISSUE_DOWNLOAD_COMPLETE,
           SUM(CASE WHEN NIM_EVENT_TYPE_ID = 886 THEN 1 ELSE 0 END) AS PICKER_SEND_PICKS
   FROM RDMAVWSANDBOX.VwNIMEventFct
   GROUP BY NIM_USER_ID, MONTH('EVENT_GMT_TIMESTAMP')
  </code></pre>
  
  <p>The error message returned by my SQL client, Teradata, says:
  "SELECT FAILED Error 3706 Syntax error expected something in between ',' and the MONTH keyword.</p>
  
  <p>This is my first time doing two things: Grouping By twice and using the Month function.</p>
  
  <p>What am I doing wrong here? How do I group by email address users in each month?</p>