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