diff --git a/Easy/00197-rising-temperature.sql b/Easy/00197-rising-temperature.sql index 4aa8701..c4adc23 100644 --- a/Easy/00197-rising-temperature.sql +++ b/Easy/00197-rising-temperature.sql @@ -4,8 +4,11 @@ -- current temp should be greater than previous temp -- we want output that satisfies all these conditions, hence putting everything in 'ON' clause. we can filter data using WHERE as well -select w1.id as Id -from Weather w1 inner join Weather w2 on datediff(w1.recordDate, w2.recordDate) = 1 and w1.temperature > w2.temperature +SELECT w1.id +FROM Weather w1 +INNER JOIN Weather w2 +ON DATEDIFF(w1.recordDate, w2.recordDate) = 1 +AND w1.temperature > w2.temperature; -- google- 3 -- adobe- 2