[Err] 1052 - Column 'XXXX' in field list is ambiguous
例如:
SELECT
id,
a.name,
price,
`describe`,
schoolid,
`subject`
FROM
tariffpackages a,
schooluser b
WHERE
a.schoolid=b.Schoolid
出现错误:
[SQL]SELECT
id,
a.name,
price,
`describe`,
schoolid,
`subject`
FROM
tariffpackages a,
schooluser b
WHERE
a.schoolid=b.Schoolid
[Err] 1052 - Column 'schoolid' in field list is ambiguous
原因是:
tariffpackages表和schooluser表中都有schoolid字段。
解决方法:
SELECT
id,
a.name,
price,
`describe`,
a.schoolid,
`subject`
FROM
tariffpackages a,
schooluser b
WHERE
a.schoolid=b.Schoolid