Answers for "sql query to get min and maximum date"

SQL
1

where date = max(date) in sql

SELECT report_id, computer_id, date_entered
FROM reports AS a
WHERE date_entered = ( SELECT MAX(date_entered) FROM reports );
Posted by: Guest on July-08-2021
0

difference between min and max date sql

SELECT
    T.location,
    Maxv.Amount - Minv.Amount as difference
FROM
(
    SELECT
       location,
       MIN(date) MinDate,
       MAX(date) MaxDate
    FROM
      Tbl A 
    GROUP BY
      location
) T INNER JOIN 
Tbl Minv ON T.MinDate = Minv.date AND T.location = Minv.location INNER JOIN 
Tbl Maxv ON T.MaxDate= Maxv.date AND T.location = Maxv.location
Posted by: Guest on July-14-2021

Code answers related to "sql query to get min and maximum date"

Code answers related to "SQL"

Browse Popular Code Answers by Language