为什么更高的mysql版本会出错

时间:2015-03-07 07:11:00

标签: php mysql

我有一个在本地主机上正常运行的SQL查询但是当我将它上传到安装了更高版本MySQL的真实服务器时,它会给我一个错误:

" #1054 - Unknown column 'subject.customers_fullname' in 'field list' "

这是查询...

SELECT nf.*,
       actor.customers_fullname AS actor_name,
       actor.customers_id AS actor_id,
       subject.customers_fullname AS subject_name
FROM portal_notifications nf,
     customers actor,
     customers SUBJECT
WHERE subject_id = 1
  AND nf.actor_id = actor.customers_id
  AND nf.subject_id = SUBJECT.customers_id
  AND status = 'unseen'
ORDER BY nf.id DESC LIMIT 0,10

1 个答案:

答案 0 :(得分:0)

尝试在字段列表中写入此内容,因为alisas名称为SUBJECT,您在[{1}}中使用subject区分大小写。

UNIX

而不是

SUBJECT.customers_fullname AS subject_name
  

默认情况下,表别名在Unix上区分大小写,但在Windows或Mac OSX上则不区分。

别名在subject.customers_fullname AS subject_name 操作系统Reference中区分大小写。