Forum Discussion

Raj's avatar
Raj
New Contributor II
8 years ago

Update table redshift

I have a requirement where I need to populate running totals: Eg.

Date Product value cum_total
20180201 abc 5 5
20180202 abc 2 7
20180203 abc 4 11
20180204 abc 3 14

This is a simplified version. There are pre-processing to get the data to be loaded to this table. I need to read this table and update the cum_total. By looking at the Redshift Update, my select query will be from this table first 3 columns, and I generate cum_total and I need to update the same table based on the keys – col1 and col2.

Thanks.

4 Replies

    • Raj's avatar
      Raj
      New Contributor II

      Yea. I can generate the running totals using sql, but to update i need to use a bunch of keys – at least 4. Looked at the Redshift Update snap and really not sure on how to use the where_clause.

      Thanks.

      • aleung's avatar
        aleung
        Contributor III

        PM me, if you like to discuss this over a call