我想離開加入這個查詢,但它似乎沒有工作選擇查詢
select *,(SELECT datediff(t1.expirydate,CURDATE())as daysleft
from tbl1 t1,
left join tbl2 t2 on (t1.mid=t2.mid and t1.pid=t2.pid and t1.uid=3)
你有你的SQL語法錯誤;
right syntax to use near 'left join tbl2 t2 on (t1.mid=t2.mid and t1.pid=t2.p' at line 3
請讓我知道我錯了
我在這裏加入3表,但是對於KNW 3臺不工作
SELECT t1.*, t2.*,t3.* datediff(t1.expirydate, CURDATE()) AS daysleft FROM tbl1 t1 left join
tbl2 t2 on t1.mid = t2.mid and t1.pid = t2.pid left join tbl3 t3 on t3.pid = t2.pid where t1.uid=3
但我得到的語法錯誤
+1用來說明有關工作條款 –
謝謝你解釋..... – hir
這裏我加入3表,但沒有工作SELECT t1。*,t2。*,t3。* datediff(t1.expirydate,CURDATE())AS daysleft FROM tbl1 t1 left join tbl2 t2 on t1.mid = t2.mid and t1 .pid = t2.pid在t3.pid = t2.pid中加入tbl3 t3,其中t1.uid = 3 ..........對於knw 3表,但是我得到語法錯誤 – hir