Say I have the following records in the Database
name | address | data
Ann | CA | 2020-12-03
Ann | TX | 2019-04-06
Ann | NY | 2018-09-12
I'm running the following query which produces the "Actual Output"
SELECT name, address, date from mydb
GROUPBY name;
Actual Output
name | address | data
Ann | NY | 2018-09-12
How can I get the below "Desired Output"? I thought of doing ORDERBY date first followed by GROUPBY but that syntax is wrong and is not allowed.
# Incorrect Query
SELECT name, address, date from mydb
ORDERBY date ASC GROUPBY name;
Desired Ouput
name | address | data
Ann | CA | 2020-12-03
Is there a way to get "Desired Output" using SQL query?
NOTE: The 3 records shown above are for example purpose only and in actual there are n records with different names.
Please someone update the question accordingly. I'm not able to form the short question.