Select Latest Data from Table

Problem

Given the following database table: DATA (id, data_date, data_value). The id field is not unique. Write an SQL statement to select the latest value for each id

Solution

Group rows by id then select rows with maximum date

Code

Here is the code

Tags:
One Comment

Add a Comment

Your email address will not be published. Required fields are marked *