From 2a354fa1e07a857fb8dfae6baafdfd252c4c076f Mon Sep 17 00:00:00 2001 From: Ar3mis22 <98519242+Ar3mis22@users.noreply.github.com> Date: Wed, 19 Jun 2024 17:46:28 +0530 Subject: [PATCH] Update 00197-rising-temperature.sql --- Easy/00197-rising-temperature.sql | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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