02-14-2018 03:40 PM
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.
02-14-2018 04:06 PM
Is this similar to your other post, How to get Running Totals?
02-14-2018 04:10 PM
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.
02-14-2018 04:57 PM
PM me, if you like to discuss this over a call
02-15-2018 09:36 AM
Got it. I should be using bulk upsert snap instead of update snap.
Cheers.