sql where max date 1

sql where max date

SELECT report_id, computer_id, date_entered
FROM reports AS a
WHERE date_entered = ( SELECT MAX(date_entered) FROM reports );

Here is what the above code is Doing:
1. We’re selecting the report_id, computer_id, and date_entered columns from the reports table.
2. We’re using a subquery to find the maximum date_entered value in the reports table.
3. We’re using the subquery to filter the reports table to only include rows where the date_entered column is equal to the maximum date_entered value.

Similar Posts