where子句中的未知列,但在select中指定了列

时间:2018-06-25 10:14:04

标签: mysql sql

我正在使用以下查询

SELECT COALESCE(curr_bid, start_bid) AS `bid`, `lot`.*, (SELECT COUNT(id) from bid where lot_id=lot.id) as bids_count FROM `lot` LEFT JOIN (SELECT `lot_step`.`id`, `lot_step`.`lot_id`, max(amount) as curr_bid FROM `lot_step` GROUP BY `lot_step`.`lot_id`) `ls` ON lot.id = ls.lot_id  WHERE ((`bid` >= '100') AND (`bid` <= '100000000'))

但是我总是得到Unknown column 'bid' in 'where clause'。不确定如何发生,因为我在SELECT之后指定了列

0 个答案:

没有答案