(转载)在mysql中,column 'id' in field list is ambiguous

(转载)http://blog.chinaunix.net/uid-20665047-id-3137284.html

column 'id' in field list is ambiguous
这个错误,是因为你查询语句里面有id字段的时候,没有说明是哪个表的id字段,应该加上表名(或者别名)来区分。

用表名进行区分的例子:
select student.id, student.name, score.total
from student, score
where student.id = score.id

使用别名的例子:
用表名进行区分的例子:
select s.id, s.name, c.total
from student s, score c
where s.id = c.id

许多教材都大量使用别名,其实对于初学者,我建议大家看得懂别名就行,自己写的时候用表名好

原文地址:https://www.cnblogs.com/Robotke1/p/3326271.html