我想建立一個查詢,以輸出Comments
,Comment_Date
,Username
或First_Name
取決於是否UserID
或StaffID
錶行中pressent。查詢,以顯示兩個連接
我可以只用UserID
或StaffID
工作,但是當我添加這兩個連接時,它什麼都不顯示。
因此,我需要再次輸出Comments
,Comment_Date
,Username
和First_Name
。 任何幫助表示讚賞。
我查詢
select('Report_Comments.Comments, Report_Comments.Comment_Date, Login.Username, staff.First_Name')
->from('Report_Comments')
->join('Login staff', 'Report_Comments.UserID = Login.LoginID')
->join('staff', 'Report_Comments.UserID_Staff = staff.StaffID');
嗯,它不通過這種方式得到的數據,如果我只有一個連接它的工作,但與兩個它不會檢索數據。但它似乎是正確的。我有一個戲。 – Beep
它可以工作,如果我刪除了加入,但他們不一起工作 – Beep