select source.title, dest.title from links l
inner join nodes source on source.id = l.source
inner join nodes dest on dest.id = l.dest
where l.type = '"id"'
and source.file not like '%daily%';
Find orphaned records
select n.id, n.title
from nodes n
where not exists (
select null from links l where n.id = l.source
)
and not exists (
select null from links l where n.id = l.dest
);