多表连查出现Column 'creationDate' in order clause is ambiguous问题
作者:互联网
问题代码
select count(1) as count from smbms_user u,smbms_role r where u.userRole = r.id
order by creationDate DESC limit 0,5
问题根源
主要是两个表都有creationDate,sql不知道按照哪一个表去排序,所有会报这个指定不清的错
解决方法
在要排序的列名之前加上表名即可,如下
select count(1) as count from smbms_user u,smbms_role r where u.userRole = r.id
order by u.creationDate DESC limit 0,5
标签:count,ambiguous,多表连查,Column,id,smbms,creationDate,order,select 来源: https://www.cnblogs.com/luoking/p/15793686.html