tohle by mělo stačit:
select distinct on (api_user.id) api_user.id,api_booking.install_ts
from api_booking inner
join api_user on api_booking.user_id=api_user.id
and api_booking.status='completed'
order by api_user.id,api_booking.install_ts
limit 20 ;