0
我在計算如何解決此查詢時遇到問題。包含WHERE,AND或OR子句的SQL語句的問題codeigniter
這裏是我笨代碼
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();
這是我得到
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')`
由於提前對您有所幫助的錯誤!