I am using MySQL db and I have two tables, the first one is like this:
Product
GTIN | Name | Dosage | Quantity
111 AAA 10 500
222 BBB 35 199
333 CCC 15 33
and the second table,
Product_price
ID | GTIN | product_price | product_date
1 111 15 2020-11-23 10:30:00
1 111 17 2021-07-15 08:05:17
1 222 35 2019-01-03 00:00:00
1 111 19 2022-01-09 11:35:00
1 333 65 2011-11-11 00:00:00
1 222 45 2021-11-23 00:00:00
Can someone help me to get the desired result? I want to get the latest price for each product based on gtin. The result would look like this,
Result
GTIN | Name | Dosage | Quantity | Price
111 AAA 10 500 19
222 BBB 35 199 45
333 CCC 15 33 65