答案 0 :(得分:0)
我使用子查询
有以下解决方案select t1.person_id,
t1.date as start_date,
(
select max(date)
from your_table t2
where t2.date > t1.date and t2.date < ALL(
select date
from your_table t3
where t3.first = 1 and t3.date > t1.date)
) as end_date
from your_table t1
where t1.first = 1