select
insertion_id, created, i.prof_id, z.postcode, i.category_id, i.area_id,
title, description, is_offer, is_paid, max_distance, i.is_verified, delete_on,
p.name as prof_name, email, c.name as category_name, a.name as area_name
from insertion i
inner join zip_code z on i.zip_id = z.zip_id
inner join professor p on i.prof_id = p.prof_id
inner join insertion_category c on i.category_id = c.category_id
inner join insertion_area a on i.area_id = a.area_id
where i.is_verified = true
and insertion_id <= (
select min(insertion_id)
from (
select 0 as insertion_id, '1970-01-01 00:00:00.000000' as created
union
select insertion_id, created from insertion order by insertion_id desc limit 101
) -- ALIAS HIER ERFORDERLICH
)
order by i.created desc limit 10 ;
Edited 1 time(s). Last edit at 03/07/2022 11:44AM by Peter Brawley.