#1054 - “字段列表”中的未知列“所有者”

时间:2015-03-29 18:35:02

标签: mysql sql

我有LOWER(Owner)

SELECT LOWER(Owner) FROM ...的查询结果

但我希望此LOWER(Owner)代表name,但我的查询错误提示:#1054 - Unknown column 'Owner' in 'field list'

SELECT LOWER(Owner) AS name FROM (
    SELECT LOWER(Owner) FROM ...
) AS buyers

2 个答案:

答案 0 :(得分:1)

这是因为子查询没有列owner。所以添加这样的别名:

SELECT owner FROM (
    SELECT LOWER(Owner) AS Owner FROM ...
) AS buyers

答案 1 :(得分:0)

将别名放在子查询中:

SELECT name
FROM (SELECT LOWER(Owner) as name FROM ...
     ) AS buyers