简体   繁体   中英

1052 - Column 'typeid' in field list is ambiguous

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

1, table archives have fileds: id,pubdate,typeid...

2, table jobrt have fields:aid,jobname,jobdepart,jobplace,jobnumber,jobcontact, typeid..

3, id=aid

now, i want to select out the id column the jobname,jobplace comlumns when typeid=19,..

thank you

since two tables: archives and jobrt contains columnName typeID , you need to specify the tableName where the value came from, eg

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

You should identify what table in the select, something like the following:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM