select Id from (select weather.*,case when temp>lag(temp,1) over(order by id) then 1 else 0 end as newcol from weather) where newcolu=1; Above query also works fine
@yaswanthkumarreddyvalluru93032 жыл бұрын
select w.id from(select id,[Date],temperature, lag(temperature) over(order by [Date]) as prevtemp from Weather) w where w.temperature>w.prevtemp CAN BE SOLVED USING LAG WINDOW FUNCTION
@vijay.s-ll1yq9 ай бұрын
with cte as (select *,lag(temp,1,temp) over (order by id) as compare_lag from weather) select id from cte where temp > compare_lag
@prashantsamant27302 жыл бұрын
Select id from (select * from weather case when temp > lag(temp , 1) over(order by id) then 1 else 0 end) as res where res = 1 ;
@vikasrajput2262 жыл бұрын
for 1 question you took aprox 15 mins.
@CloudyML2 жыл бұрын
Hi Vikas, this is for teaching purpose and we have shown 3 ways to solve this problem. That's why it took time.