difference between min and max date sql

Solutions on MaxInterview for difference between min and max date sql by the best coders in the world

showing results for - "difference between min and max date sql"
Noeline
04 Jan 2020
1SELECT
2    T.location,
3    Maxv.Amount - Minv.Amount as difference
4FROM
5(
6    SELECT
7       location,
8       MIN(date) MinDate,
9       MAX(date) MaxDate
10    FROM
11      Tbl A 
12    GROUP BY
13      location
14) T INNER JOIN 
15Tbl Minv ON T.MinDate = Minv.date AND T.location = Minv.location INNER JOIN 
16Tbl Maxv ON T.MaxDate= Maxv.date AND T.location = Maxv.location
17