L
where f.customer_id = a.customer_id
and f.create_date < a.create_date)
Size: a a a
ДМ
SELECT t.customer_id,
t.create_date,
t.loan_id,
row_number() OVER (PARTITION BY t.customer_id ORDER BY t.create_date) AS loan_count
FROM ( SELECT DISTINCT ON (statistic.loan_id) statistic.loan_id,
statistic.customer_id,
statistic.create_date
FROM loans.statistic
ORDER BY statistic.loan_id, statistic.statistic_date) t
GROUP BY t.customer_id, t.loan_id, t.create_date;
ДМ
ДМ
ДМ
H
ДМ