猿问

sql server group by 嵌套 group by 问题

select cuid from (select cuid,eid from test_sale group by cuid,eid ) group by cuid having count(eid)>=2 

查询提示 “关键字 group 附近语法错误” 

绝地无双
浏览 789回答 1
1回答

慕尼黑的夜晚无繁华

group by 前面要加个别名,select cuid from (select cuid,eid from test_sale group by cuid,eid ) as t1 group by cuid having count(eid)>=2或者此查询也可以直接改为如下select cuid from test_sale group by cuid having count(eid) >= 2
随时随地看视频慕课网APP

相关分类

SQL Server
我要回答