我有一个表genrelink和其他类型描述,其中以下几列
Genere link table :
titleID
GENID1
GENID2
GENID3
GENID4
GENID5
GenereDesscription table
GENID
DESC
我想在一击中获得Genere Link的所有GENID的Genere描述。
最佳答案
这应该为您工作:
SELECT titleID,
b.description AS description1,
c.description AS description2,
d.description AS description3,
e.description AS description4,
f.description AS description5
FROM Genere a
LEFT JOIN GenereDesscription b
ON a.GENID1 = b.GENID
LEFT JOIN GenereDesscription c
ON a.GENID2 = c.GENID
LEFT JOIN GenereDesscription d
ON a.GENID3 = d.GENID
LEFT JOIN GenereDesscription e
ON a.GENID4 = e.GENID
LEFT JOIN GenereDesscription f
ON a.GENID5 = f.GENID;