2 задачка по СКЛ. Вроде норм
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
with base as (
|
||||
select
|
||||
employee_id,
|
||||
to_dt,
|
||||
from_dt,
|
||||
lag(to_dt) over (partition by employee_id order by from_dt) lag_to_dt
|
||||
from abakhytbekuly.salary
|
||||
),
|
||||
error as (
|
||||
select
|
||||
employee_id,
|
||||
from_dt,
|
||||
case when
|
||||
lag_to_dt > from_dt then 'пересечение'
|
||||
when
|
||||
lag_to_dt < from_dt then 'дыра'
|
||||
end as status
|
||||
from base
|
||||
where lag_to_dt is not null
|
||||
)
|
||||
select *
|
||||
from error
|
||||
order by employee_id, from_dt
|
||||
Reference in New Issue
Block a user