Пожалуйста, используйте запрос ниже. Вы можете использовать ROW_NUMBER()
select timestamp, internal, external, client_name from
(select timestamp, internal, external, client_name, row_number() over(partition by client_name order by timestamp desc) rnk
from (select *, (refno_id || ' - ' ||
client_name) ref_cl from (select distinct timestamp::text, internal::int, external::int, refnum FROM reports_jobpull_active_jobss) AS jp_active
left join
(select client_name, refno_id from accessibility_ph_refno) AS ph_refno
on jp_active.refnum = ph_refno.refno_id) jp_data where split_part(timestamp::text,' ',1) in (SELECT distinct split_part(timestamp::text,' ',1) date FROM reports_jobpull_active_jobss order by date DESC limit 10)) qry
where rnk in (1,2);