SELECT ra.*
FROM responses rd
JOIN responses ra
ON (ra.id_s, ra.id_p) = (rd.id_s, rd.id_p)
WHERE (rd.id_q, rd.answer) = (3, 'D')
SELECT ra.*
FROM responses rd
JOIN responses ra
ON (ra.id_s, ra.id_p) = (rd.id_s, rd.id_p)
WHERE (rd.id_q, rd.answer) = (3, 'D')