1052 - 字段列表中的列'typeid'不明确

时间:2012-12-12 02:56:47

标签: mysql sql mysql-error-1052

select id,pubdate, typeid,aid,jobname,jobdepart,jobplace,jobnumber,jobcontact from
  archives right join jobrt on id=aid where typeid=19

1,表档案有fileds:id,pubdate,typeid ......

2,表格工作有字段:援助,工作名称,工作部门,工作地点,工作号码,工作联系人,类型...

3,id = aid

现在,我想在typeid = 19时选择id作为jobname,jobplace comlumns的列。

谢谢

2 个答案:

答案 0 :(得分:0)

由于两个表:archivesjobrt包含columnName typeID,因此您需要指定值来自的tableName,例如

SELECT    id
        , pubdate
        , jobrt.typeid
        , aid
        , jobname
        , jobdepart
        , jobplace
        , jobnumber
        , jobcontact
FROM    archives
        RIGHT JOIN jobrt
            ON archives.id = jobrt.aid
WHERE   jobrt.typeid = 19

答案 1 :(得分:0)

您应该确定select中的哪个表,如下所示:

select archives.id,archives.pubdate, archives.typeid,aid,jobname,jobdepart,jobplace,jobnumber,jobcontact from
  archives right join jobrt on id=aid where typeid=19