SELECT linka
  FROM linky
 WHERE EXISTS (SELECT zastavka
                 FROM zastavky
                WHERE id = zastavka_id
                      AND zastavka='Nad Primaskou');