Ver originalSELECT m.id_hruta FROM maestro m LEFT JOIN detalle d ON m.id_hruta = d.id_hruta WHERE d.id_hruta IS NULL
Ver originalSELECT m.id_hruta FROM maestro m WHERE m.id_hruta NOT IN(SELECT id_hruta FROM detalle )