Gopneg
public text v1 · immutableselect count(t2.date) cnt, t2.date
from
(select distinct p.date + t.time_out date
from pass_in_trip p, trip t where p.trip_no = t.trip_no) t1,
(select distinct p.date + t.time_out date
from pass_in_trip p, trip t where p.trip_no = t.trip_no) t2
where t1.date >= t2.date
group by t2.date