I am having trouble figuring out how to fix this query.
Here is my CodeIgniter code
return $this->db
->select('vehVin, vehMake, vehModel, seller, dealership, buyer, logistics.warehouseName, transportDate, car_tracking.keys, car_tracking.window')
->where('transportDate <', $yesterday)
->where('(car_tracking.keys', "'0'", FALSE)
->or_where("car_tracking.stickers = '0')", NULL, FALSE)
->join('logistics', 'logistics.stockid = vehicles.stockid')
->join('car_tracking', 'car_tracking.stockid = logistics.stockid')
->get('vehicles')
->result();
And this is the error I am getting
Unknown column 'car_tracking.stickers' in 'where clause'
`SELECT `vehVin`, `vehMake`, `vehModel`, `seller`, `dealership`, `buyer`, `logistics`.`warehouseName`, `transportDate`, `car_tracking`.`keys`, `car_tracking`.`window`
FROM (`vehicles`)
JOIN `logistics` ON `logistics`.`stockid` = `vehicles`.`stockid`
JOIN `car_tracking` ON `car_tracking`.`stockid` = `logistics`.`stockid`
WHERE `transportDate` < '2013-11-25'
AND (car_tracking.keys = '0' OR car_tracking.stickers = '0')`
Thanks ahead of time for your help!
Make sure car_tracking.stickers exists. I would also consider putting the sql query raw. because codeigniter's query builder has a lot of issues. It cannot handle most of query conditions when they are used together.
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.