with cte1 as( select *, row_number() over(partition by ph_no order by start_time) as r_no from call_start), cte2 as( select *, row_number() over(partition by ph_no order by end_time) as r_no from call_end) select cte1.ph_no, cte1.start_time, end_time, timediff(start_time,end_time) as duration from cte1 inner join cte2 on cte1.r_no=cte2. r_no and cte1.ph_no=cte2. ph_no;
Its out of my mind
Wow great 👍
Thanks! 😊
Nice pls post more questions
with cte as(
select *,row_number()over() rnk from call_start
),
cte2 as(
select *,row_number()over() rnk from call_end
)
select t1.ph_no,t1.start_time,t2.end_time,extract(minute from (end_time-start_time)) from cte t1
join cte2 t2
on
t1.rnk = t2.rnk
with cte1 as(
select *, row_number() over(partition by ph_no order by start_time) as r_no
from call_start),
cte2 as(
select *, row_number() over(partition by ph_no order by end_time) as r_no
from call_end)
select cte1.ph_no, cte1.start_time, end_time, timediff(start_time,end_time) as duration
from cte1 inner join cte2 on cte1.r_no=cte2. r_no and
cte1.ph_no=cte2. ph_no;