在MySQL查詢的WHERE子句中使用列別名會(huì)產(chǎn)生錯(cuò)誤我正在運(yùn)行的查詢?nèi)缦滤荆俏业玫搅诉@個(gè)錯(cuò)誤:#1054-‘IN/All/ANY子查詢’中未知列‘已保證的_郵政編碼’SELECT `users`.`first_name`, `users`.`last_name`, `users`.`email`,SUBSTRING(`locations`.`raw`,-6,4) AS `guaranteed_postcode`FROM `users` LEFT OUTER JOIN `locations`ON `users`.`id` = `locations`.`user_id`WHERE `guaranteed_postcode` NOT IN #this is where the fake col is being used(
SELECT `postcode` FROM `postcodes` WHERE `region` IN
(
'australia'
))我的問題是:為什么我不能在同一DB查詢的WHERE子句中使用假列?
在MySQL查詢的WHERE子句中使用列別名會(huì)產(chǎn)生錯(cuò)誤
泛舟湖上清波郎朗
2019-06-29 10:06:12