今天在写一个sql连接语句的时候出现如下报错:
mysql> select no,keno,score from (select Emp.no no,Course.keno keno from Emp,Course) c left join Score s on c.no=s.no and c.keno=s.keno;
ERROR 1052 (23000): Column 'no' in field list is ambiguous
在网上查了下是因为在连接多个表查询的时候要制定字段的表,不然数据库不知道如何查询。将语句更改成如下就顺利通过了:
select c.no,c.keno,s.score from (select Emp.no no,Course.keno keno from Emp,Course) c left join Score s on c.no=s.no and c.keno=s.keno;
阅读(6665) | 评论(0) | 转发(1) |