我有一個查詢的問題,比如這一個我可以檢索記錄:SQL查詢,不顯示所有記錄
SELECT
l.*,
ll.f_cocacola as cocacola,
le.name AS deposit,
lp.price
FROM
KPC AS l,
KPC_cocacola AS ll,
KPC_deposit AS le,
KPC_price AS lp
WHERE
l.cod_deposit = le.id_deposit
AND l.code = ll.code
AND lp.code = l.code
AND l.code_deposit = '002365'
,但現在我需要包括從另一個表的另一日期-intranet-具有領域代碼和網址則需要從該表中網址秀場..記住,我們的關係就代碼場。
,所以我更改查詢,以這樣的方式
SELECT l.*,ll.f_cocacola as cocacola, le.name AS deposit,
lp.price, lintranet.url
FROM tableX AS l, intranet_cocacola AS ll, tableX_deposit AS le,
tableX_price AS lp,
tableX_intranet as lintranet
WHERE l.code_deposit = le.id_deposit
AND l.code = ll.code
AND lp.code = l.code
AND l.code = lintranet.code
AND l.code_deposit = '456852147'
但問題是,一些記錄沒有網址,如果不存在網址那麼這個查詢不告訴我的記錄..以及我所需要的,即使沒有一個URL關聯到我希望看到recorda的記錄,由於
你的答案是相當更加清晰,我選擇了這一個,我也給予好評的@zerkms回答 – hibigo 2012-04-17 23:15:28