The query that is causing the error is below:
$query = $model::find()
->leftJoin('reseller_config', 'reseller_rate.resellerref = reseller_config.resellerref')
->select('reseller_rate.*, reseller_config.resellerref AS rate_increase');
The sql generated is as follows:
SELECT COUNT(*) FROM `reseller_rate` LEFT JOIN `reseller_config` ON reseller_rate.resellerref = rc.resellerref WHERE `resellerref`=56
I know it's not working because the fields are named the same and it doesn't know which one to grab.
Does anyone know how I can work around this?
$query = $model::find()
->leftJoin('reseller_config', 'reseller_rate.resellerref = reseller_config.resellerref')
->select('reseller_rate.*', 'reseller_config.resellerref AS rate_increase');
you can use this with query bulider :
$model = (new Query())
->select(['reseller_rate.*', 'reseller_config.resellerref AS rate_increase')
->from('reseller_rate')
->leftJoin('reseller_config', 'reseller_rate.resellerref = reseller_config.resellerref')
->all();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.