ac
Size: a a a
ac
B
OS
R
B
PC
select
value
from
(select row_to_json(row(col1, col2)) json from (values (1, 1, 2), (2, 1, 3), (3, null, null), (4, null, 4)) t1 (id, col1, col2)) t1
left join lateral (select * from json_each(t1.json)) j1 on true
KN
KN
PC
select
user_id, min(in_date), max(out_date),
sum(least(out_date, t1.date + end_work) - greatest(in_date, t1.date + start_work)) filter (
where (in_date >= t1.date + start_work and in_date < t1.date + end_work)
or (coalesce(out_date, current_timestamp) >= t1.date + start_work and coalesce(out_date, current_timestamp) < t1.date + end_work)
)
from attendances
inner join (values ('2021-06-21'::timestamp)) t1 (date) on
(in_date >= t1.date and in_date < t1.date + interval '1 day')
or (coalesce(out_date, current_timestamp) >= t1.date and coalesce(out_date, current_timestamp) < t1.date + interval '1 day')
where
user_id = 2
group by user_id;
V💩
кн
AM
кн
кн
AM
AM
AM
кн
AM
кн