Im a beginner using SQL and I am wondering if someone could help. I have 2 Tables Table 1 is Customer Table like the below
CUSTOMER ID - CUSTOMER JOIN DATE
1234 01/03/2018
2345 21/07/2019
Table 2 is a Value Segment
CUSTOMER ID - VALUE - LOADED_DATE
1234 HIGH 01/09/20
1234 MEDIUM 01/10/20
2345 LOW 01/09/20
2345 LOW 01/10/20
What I need to do is join the Customer table and bring back the Customer ID and Joined Date and then bring back the value from the Value Segment table which has the latest Loaded date so my table would look like below
CUSTOMER ID - CUSTOMER JOIN DATE - VALUE
1234 01/03/2018 MEDIUM ( as it was loaded on 01/10/20)
2345 21/07/2019 LOW
Thanks in advance
Thanks, Mike
One option could be using
row_number()