[英]mysql error: #1052 - Column 'id' in from clause is ambiguous
I need join twice for same table - age so I can order by one field of age, how come is it? 我需要在同一张桌子上加入两次-年龄,所以我可以按一个年龄段排序,结果如何?
mysql error: #1052 - Column 'id' in from clause is ambiguous
mysql错误:#1052-from子句中的列“ id”不明确
select * from `students` `s` JOIN `age` `a` on `s`.`SN`=`a`.`SN` JOIN (SELECT `s`.`id` FROM `students` `s` JOIN `age` `a` on `s`.`SN`=`a`.`SN` WHERE 1 order by `a`.`age` asc limit 0,2) p using(id) order by `a`.`age` asc
The id
is actually ambiguous , explicitly specify the table name, replace: id
实际上是模棱两可的 ,显式指定表名,替换为:
using(id)
with: 有:
using(p.id)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.