РЖ
Но проще научиться этому самому join
Size: a a a
РЖ
ch
Ю
ch
¯\_(ツ)_/¯PC
select
sum(least(out_date, t1.date + end_work) - greatest(in_date, t1.date + start_work))
from attendances
inner join (values ('2021-06-22'::timestamp)) t1 (date) on
(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)
where
user_id = 11
group by user_id;
RL
່່
RL
່່
AC
select
transactions.id,
transactions.type,
transactions.from_address,
transactions.to_address,
transactions.currency_name,
transactions.amount,
transactions.time
from transactions
join (
select address from wallets where user_id = 160
) as user_wallet
on from_address = user_wallet.address
or
to_address = user_wallet.addressAC
select amount::bigint from balances
ERROR: value "14945588980124090388" is out of range for type bigint
SQL state: 22003
:(RL
່່
RL
DO
AC
AC
S)