0
select distinct name from medication where code in (select medication_code from donors_medications where donor_id in (select don
this code is giving wrong answer as output is the code correct
1 Odpowiedź
+ 1
SELECT name
FROM medication AS med
INNER JOIN donors_medications AS dmed
ON med.code= dmed.medication_code
INNER JOIN don
ON dmed.donor_id = don.donor_id
This should work if I understand your attempt correctly. The last part "donor_id.don" depends on donor_id being the name of the field for the donor ID in the don table.
If this does not work, can you describe what you want to select from your database and what your database and tables look like?