我想從表2中獲取c.cf_condition
,c.cf_condition_value
和c.cf_warranty
的值。這些屬性不在表1中。我使用了每個連接條件,但沒有發生任何事情。這些值可以在內部連接時顯示,但沒有WHERE p.cf_IsDailyDeal=1
條件。如果我不是這個where子句,那麼我所需的行不顯示。我想獲取三個屬性,但用這個where子句:如何從另一個表中獲取不在第一個表中的值
SELECT p.im_folder,
p.im_name,
p.cf_price_check,
p.category_id,
p.classifieds_id,
p.cf_price_check,
p.classifieds_id,
p.cf_title,
p.cf_addeddate,
p.cf_price,
(SELECT c.cf_condition FROM as_classifieds as c WHERE c.classifieds_id = p.classifieds_id),
(SELECT c.cf_condition_value FROM as_classifieds as c WHERE c.classifieds_id = p.classifieds_id),
(SELECT c.cf_warranty FROM as_classifieds as c WHERE c.classifieds_id = p.classifieds_id)
FROM as_index_classifieds as p
WHERE p.cf_IsDailyDeal=1;
你可以看看 [這裏](http://stackoverflow.com/questions/12364602/mysql-inner-join-where-clause)或[這裏](http://stackoverflow.com/questions/18153665/inner-join-where-clause)的答案 – SirHenry
我不明白你的問題。試圖澄清可能是有用的,也許有一些樣本數據。 – Anders
我想從表'as_classifieds'中獲取列c.cf_condition,c.cf_condition_value和c.cf_warranty的值。這些列不在表'as_index_classifieds',我使用第二張桌上的選擇查詢,我想這些3值顯示當我回顯這些 –