【问题标题】:1052 - Column 'typeid' in field list is ambiguous1052 - 字段列表中的列 'typeid' 不明确
【发布时间】:2012-12-12 02:56:46
【问题描述】:
select id,pubdate, typeid,aid,jobname,jobdepart,jobplace,jobnumber,jobcontact from
  archives right join jobrt on id=aid where typeid=19

1、表格档案有files: id,pubdate,typeid...

2、表jobrt有字段:aid,jobname,jobdepart,jobplace,jobnumber,jobcontact,typeid..

3,id=aid

现在,我想在 typeid=19 时选择 id 列 jobname,jobplace comlumns,..

谢谢

【问题讨论】:

    标签: mysql sql mysql-error-1052


    【解决方案1】:

    由于两个表:archivesjobrt包含columnNametypeID,因此需要指定值来自的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
    

    【讨论】:

      【解决方案2】:

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

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

      【讨论】:

        猜你喜欢
        • 2011-10-02
        • 1970-01-01
        • 1970-01-01
        • 2018-11-10
        • 1970-01-01
        • 2015-01-30
        • 1970-01-01
        • 2020-08-07
        • 1970-01-01
        相关资源
        最近更新 更多