0
我想加入我的查詢,但我無法取得任何成功,我想查詢product
表中的productname
,如果product_id
存在於productplan
表中。如何在cakephp中多次加入?
Producttable
id name
1 a
2 b
productplantable
id product_id
1 1
2 2
這是我的查詢:
$p_products = $this->ProductPlan->find('all',
array('fields'=>
array('ProductPlan.product_id',
'Product.name')
)
);
$this->set('p_products',$p_products);
您是否定義了各個模型中兩個表之間的關係? – Rikesh 2013-02-15 05:39:20
確定關係中沒有問題,產品hava hasmany關係和產品計劃都屬於與產品的關係 – 2013-02-15 05:42:02
有意義的關係已定義 – 2013-02-15 05:45:21