(转载)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

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

相关文章:

  • 2022-12-23
  • 2021-05-26
  • 2022-01-04
  • 2021-06-11
  • 2022-12-23
  • 2021-08-06
  • 2021-10-16
  • 2021-04-10
猜你喜欢
  • 2022-12-23
  • 2021-11-06
  • 2022-12-23
  • 2022-12-23
  • 2021-08-18
相关资源
相似解决方案