0
我有這2個表SQL兩人在另一個表中一個表引用同一列的列
tbl_link
pID | fID_a | fID_b | link_desc
1 | 1 | 2 | aa + bb
tbl_structure
pID | desc
1 | a
2 | b
fID_a和fID_b外鍵爲PID在tbl_structure fID_a不允許NULL值,而fID_b確實
我想查詢結構時檢索結構2的遞減1
此刻我的SQL查詢看起來像這樣
SELECT a.link_desc, tbl_structure.desc FROM tbl_strukture
LEFT JOIN tbl_link as a ON tbl_structure.pID = a.fID_a
LEFT JOIN tbl_link as b ON tbl_structure.pID = b.fID_b
WHERE tbl_structure.pID = 1
但我只能得到與pID 1結構的desc!
感謝您的幫助!
...其中s1.pID = 1和它的作品!謝謝! – Markus
@MarkusHölzner不客氣。很高興幫助:) – peterm