Questions tagged «mysql-error-1054»

8
在MySQL查询的WHERE子句中使用列别名会产生错误
我正在运行的查询如下,但是出现此错误: #1054-'IN / ALL / ANY子查询'中的未知列'guaranteed_postcode' 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' ) ) 我的问题是:为什么我不能在同一数据库查询的where子句中使用伪列?

11
MySQL Update查询中“字段列表”中的未知列错误
尝试执行此更新查询时,我不断收到MySQL错误#1054: UPDATE MASTER_USER_PROFILE, TRAN_USER_BRANCH SET MASTER_USER_PROFILE.fellow=`y` WHERE MASTER_USER_PROFILE.USER_ID = TRAN_USER_BRANCH.USER_ID AND TRAN_USER_BRANCH.BRANCH_ID = 17 这可能是语法错误,但是我尝试使用内部联接和其他更改,但是我不断收到相同的消息: Unknown column 'y' in 'field list'

18
位置子句中的未知列
我有一个简单的查询: SELECT u_name AS user_name FROM users WHERE user_name = "john"; 我懂了Unknown Column 'user_name' in where clause。'user_name'即使在之后,我是否也不能在声明的其他部分引用select 'u_name as user_name'?

7
我可以在SELECT查询中重用计算字段吗?
有没有一种方法可以重用mysql语句中的计算字段。我收到以下错误信息:“ unknown column total_sale”: SELECT s.f1 + s.f2 as total_sale, s.f1 / total_sale as f1_percent FROM sales s 还是我必须重复计算,如果我添加了所有需要的计算,这将导致很长的SQL语句。 SELECT s.f1 + s.f2 as total_sale, s.f1 / (s.f1 + s.f2) as f1_percent FROM sales s 当然,我可以在我的php程序中进行所有计算。
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.