Lo primero que intentaría es una subconsulta:
from ((select q.* from quanda q where q.id = :id1) union
(select q.* from quanda q where q.related = :id2)
) left join
. . .
Nota:Esto realmente quiere índices en quanda(id)
y quanda(related)
para el rendimiento.
Si se seleccionan pocas filas, esto podría ser mucho más rápido.