SQL Vertica Question (but any SQL query answer is appreciated) I have a table "Base" currently in "day-url" level, and I try to get 'score' for each url in each day by joining a "day-url" level reference table "Score Update". The problem is the reference table is not in per day but specific dates level. I need to join the score from "Score Update" with "Update Date" right before the "Date" in "Base". Example below: (Please see pictures at bottom)
What I have: (Base)
Date URL Score
2019-08-01 A
2019-08-01 B
2019-08-02 A
2019-08-03 A
2019-08-09 B
2019-08-10 A
2019-08-11 A
2019-08-11 B
2019-08-13 B
(Score Update)
Update_Date URL Score
2019-07-25 A x
2019-07-25 B y
2019-08-10 A alpha
2019-08-10 B beta
What I want is: What I have: (Base)
Date URL Score
2019-08-01 A x
2019-08-01 B y
2019-08-02 A x
2019-08-03 A x
2019-08-09 B y
2019-08-10 A alpha
2019-08-11 A alpha
2019-0B-11 B beta
2019-08-13 B beta
And both tables will keep updating for future date data. Can anyone help me how to join these 2 tables?
Thanks!