MySQL查询格式更改得到Zend TO Yii2
任何人都可以帮我要改变从ZEND格式Yii2格式下面的查询,MySQL查询格式更改得到Zend TO Yii2
$select = $db->select(); $select->from(array('u' => 'user'), array('user_id', 'name', 'dob'))
->join(array('ua' => 'User_Address'), 'ua.user_id = u.user_id', array())
->join(array('a' => 'Address'), 'a.address_id = ua.address_id', array('address_id', 'street', 'city', 'state', 'country'));
由于提前,
回答:
你可以使用如:
$rows = (new \yii\db\Query()) -select(['u.user_id', 'u.name', 'u.dob', Address.street, Address.city , Address.state, Address.country ])
->from('user u')
->join('INNER JOIN', 'User_Address', 'User_Address.user_id = u.id')
->join('INNER JOIN', 'Address', 'Address.user_id = User_Address.address_id AND ')
->all();
多见于http://www.yiiframework.com/doc-2.0/guide-db-query-builder.html
以上是 MySQL查询格式更改得到Zend TO Yii2 的全部内容, 来源链接: utcz.com/qa/264871.html