未知栏' a.Name_province'在' on条款'

时间:2014-04-29 09:10:53

标签: sql

我不知道为什么,两个网站中的相同代码的工作方式不同。在一个工作,而在另一个工作,而不是。

如果它不起作用,我有以下错误消息:

'on子句'中的未知列'a.Name_province' SQL =

SELECT  a.* ,
        b.bounty_points AS bounty ,
        b.expiry_date AS expiry ,
        b.state AS bounty_state ,
        c.id AS catid ,
        c.title AS category_title ,
        c.alias AS category_alias ,
        u1.id AS created_by ,
        u1.username AS created_by_alias ,
        u2.id AS modified_by ,
        u2.name AS modified_by_name ,
        u2.username AS modified_by_username ,
        ast.name AS nameast ,
        CASE WHEN a.created_by > 0 THEN u1.email
             ELSE a.email
        END AS email ,
        CASE WHEN a.created_by > 0 THEN u1.name
             ELSE a.user_name
        END AS username
FROM    t17wv_answers_questions AS a
        LEFT JOIN t17wv_answers_categories AS c ON a.catid = c.id
        LEFT JOIN t17wv_answers_bounties AS b ON b.question_id = a.id
        LEFT JOIN t17wv_users AS u1 ON a.created_by = u1.id
        LEFT JOIN t17wv_users AS u2 ON a.modified_by = u2.id
        LEFT JOIN t17wv_answers_state AS ast ON a.Name_province = ast.id
WHERE   ( a.catid = 2 )
        AND ( a.published = 1 )
        AND ( (c.permission_view IS NULL
              OR find_in_set('1', c.permission_view) > 0)
            )
ORDER BY a.created DESC 
LIMIT 0, 20

有什么想法吗? 谢谢你,并致以最诚挚的问候。

1 个答案:

答案 0 :(得分:0)

a.Name_province可能不存在或a.Name_province=ast.id可能没有相同的数据类型。a.Name_province拼写错误。