+ 2

Redshift SQL date function

I’m using a date stamped report and want to write a script that will calculate the daily, month-to-date and year-to-date movements, but am struggling!!! This needs to take into account business days only, so using (date - 1 ) will not work - anyone able to assist?

17th Sep 2018, 3:42 PM
Randomcoder
5 Antworten
+ 1
Hi guys, apologies for not responding! So i have a report, ‘Report-Data’ which updated on the daily with data, which is date stamped. eg rep_date value 2018-09-10 2 2018-09-11 3 2018-09-12 2.5 2018-09-14 2 so i would like to create a VIEW which subtracts the previous day’s value: output: rep_date value change 2018-09-10 2 2 2018-09-11 3 1 2018-09-12 2.5 -0.5 2018-09-14 2 -0.5 sorry for typing it like this - not sure how else to describe it? something you need to know - there will be gaps in the days and i would like to have a MTD and YTD column as well?
19th Sep 2018, 4:59 PM
Randomcoder
+ 14
Zane Van Der Schyff Please provide more information. Give me input data and desired output.
18th Sep 2018, 6:00 PM
r8w9
r8w9 - avatar
+ 9
Randomcoder Sorry. I still don't understand... What is "change" attribute? Do you get it from somewhere or it's just a your result? How is your desired value counted? value - change or change - value?
20th Sep 2018, 7:09 PM
r8w9
r8w9 - avatar
0
hi.......
19th Sep 2018, 12:07 PM
venkatesh
0
i want to know more about html..... could you please......send me the notes
19th Sep 2018, 12:08 PM
venkatesh