将SQL查询转换为Yii Criteria Query

时间:2013-07-15 11:56:26

标签: php yii

SELECT a。*,c.category_name FROM products a JOIN product_categories b ON a.id = b.product_id JOIN类别c ON b.category_id = c.id WHERE a.store_id = 20

1 个答案:

答案 0 :(得分:0)

你可以试试这个:

$data = Yii::app()->db->createCommand('Your query here')->queryAll();
var_dump($data);