title: Redshift LISTAGG frame clause
body: <p>I am trying to aggregate strings, but limited to only the preceding rows, not the whole partition. Does anyone know how to do this in Redshift?</p>
  
  <p>What I am trying to achieve is the <code>appended_event_namespace</code> column below.</p>
  
  <p><a href="https://i.stack.imgur.com/ZvI6V.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZvI6V.png" alt="enter image description here"></a></p>
  
  <p>This is what I've tried so far.</p>
  
  <pre><code>LISTAGG(event_namespace, '/')
  WITHIN GROUP (ORDER BY tstamp_true)
  OVER (PARTITION BY acct_id) AS appended_event_namespace
  </code></pre>
  
  <p>This results in the full <code>ApplicationLaunch/CategoryBrowse/NotificationCenter/UserProfile</code> aggregation on every single row instead of what is in the desired screenshot.</p>
  
  <p>The difficulty is in getting it to only append up to the current row since there doesn't seem to be a frame-clause for Redshift's LISTAGG(). Thanks for any ideas that may help.</p>