选择列表中的列 'EmployeeInfo.empName' 无效,因为该列没有包含在聚合函数或 GROUP BY 子句中。
selectcount(distinctb.empNum),b.empName,b.empId,a.udopTimefromUdopInfoa,EmployeeInfob...
select count(distinct b.empNum),b.empName ,b.empId,a.udopTime
from UdopInfo a, EmployeeInfo b
select count(distinct b.empNum),b.empName ,b.empId,a.udopTime
from UdopInfo a, EmployeeInfo b order by a.udopTime desc
两句都不对,该怎么写啊 展开
from UdopInfo a, EmployeeInfo b
select count(distinct b.empNum),b.empName ,b.empId,a.udopTime
from UdopInfo a, EmployeeInfo b order by a.udopTime desc
两句都不对,该怎么写啊 展开
展开全部
先不说你聚合函数的错误
你俩表不用关联吗?
select count(distinct b.empNum),b.empName ,b.empId,a.udopTime
from UdopInfo a, EmployeeInfo b group by b.empName ,b.empId,a.udopTime
上边那么写肯定能运行,但你俩表靠什么关联
追问
主外键关联
select count(distinct b.empNum),b.empName ,b.empId,a.udopTime
from UdopInfo a, EmployeeInfo b where a.empId=b.empId order by a.udopTime desc
追答
select count(distinct b.empNum),b.empName ,b.empId,a.udopTime
from UdopInfo a, EmployeeInfo b where a.empId=b.empId
group by b.empName ,b.empId,a.udopTime order by a.udopTime desc
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询