create table Antibiotics (id int, Name nvarchar(10));
insert into Antibiotics values(1, 'a');
insert into Antibiotics values(2, 'b');
insert into Antibiotics values(3, 'c');
insert into Antibiotics values(4, 'd');
create table Patient(id int, Name nvarchar(10), AntibioticA nvarchar(10), AntibioticB nvarchar(10), AntibioticC nvarchar(10));
insert into Patient values(1, 'John', 1, 2, 3);
insert into Patient values(2, 'Jim', 4, 2, 1);
/*
John A B C (in case id=1)
Jim D B A (in case id=2)
*/
SELECT t.bname,
(SELECT name FROM Antibiotics WHERE id = t.Antibiotica),
(SELECT name FROM Antibiotics WHERE id = t.Antibioticb),
(SELECT name FROM Antibiotics WHERE id = t.Antibioticc)
FROM
(SELECT a.id , a.name AS aname, b.name AS bname, b.Antibiotica, b.Antibioticb, b.Antibioticc
FROM Antibiotics a
INNER JOIN Patient b
ON a.id = b.id) t
SQLfiddle在这里:http ://sqlfiddle.com/#!6/1e642/1