Could you please help me with a query I'm having issues with? I tried to seach for similar questions here with no success.
I have 2 tables which I need to join and get the latest created_date from each val1, val2 unique combination.
See here for the 2 tables details: https://www.db-fiddle.com/f/87hqeMqP7sf68fxbsywm5G/0
The expected result would be this:
| val1 | val2 | num1 | num2 | created_date |
|---|---|---|---|---|
| X | A | 33 | 333 | 2022-11-03 |
| X | B | 66 | 666 | 2022-11-06 |
| X | C | 88 | 888 | 2022-11-08 |
| X | D | 99 | 999 | 2022-11-09 |
| Y | A | 111 | 1111 | 2022-11-11 |
Please use MySQL v.5.6. Thanks in advance!
A subquery would help in this case
https://dbfiddle.uk/Owdaf5Lx