title: Update Redshift table from query
body: <p>I'm trying to update a table in Redshift from query:</p>
  
  <pre><code>update mr_usage_au au
  inner join(select mr.UserId,
                    date(mr.ActionDate) as ActionDate,
                    count(case when mr.EventId in (32) then mr.UserId end) as Moods,
                    count(case when mr.EventId in (33) then mr.UserId end) as Activities,
                    sum(case when mr.EventId in (10) then mr.Duration end) as Duration
             from   mr_session_log mr
             where  mr.EventTime &gt;= current_date - interval '1 days' and mr.EventTime &lt; current_date
             Group By mr.UserId,
                      date(mr.ActionDate)) slog on slog.UserId=au.UserId
                                               and slog.ActionDate=au.Date
  set au.Moods = slog.Moods,
      au.Activities=slog.Activities,
      au.Durarion=slog.Duration
  </code></pre>
  
  <p>But I receive the following error:</p>
  
  <blockquote>
  <pre><code>ERROR: syntax error at or near "au".
  </code></pre>
  </blockquote>