create temp table tempselections as
select
	distinct on
	(ts.selectionid) ts.selectionid
from
	iszl.t_disp_direct_link as tddl
join iszl.t_selection as ts on
	tddl.Selection = ts.selectionid;

delete
from
	iszl.t_selection as ts
where
	ts.selectionid not in (
	select
		*
	from
		tempSelections);

drop table tempselections;