三条SQL语句只有一条可以执行?

makoshen 2009-07-26 10:19:21
1 strsql="select adduser,count(id) as num from [xxbs] where adduser in (select id from [uxxbs] where dj=1) group by adduser order by count(id) desc"

2 strsql="select adduser,danwei,count(id) as num from [xxbs] where adduser in (select id from [uxxbs] where dj=1) group by adduser order by count(id) desc"

3 strsql="select * count(id) as num from [xxbs] where adduser in (select id from [uxxbs] where dj=1) group by adduser order by count(id) desc"



第一个语句可以执行;需要加个字段显示,第二不可以执行超时,第三个也不可以执行,
请问想多显示个字段danwei 怎么在第一条SQL语句写.
...全文
28 点赞 收藏 4
写回复
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
makoshen 2009-07-26
谢谢
回复
hookee 2009-07-26
逻辑上只有按照adduser,danwei分组才能取每组的聚集函数,只按adduser分组的话,选danwei字段表示不出其意义了
回复
makoshen 2009-07-26
第二条不能执行 一执行就超时 为什么?
回复
hookee 2009-07-26
strsql="select adduser,danwei,count(id) as num from [xxbs] where adduser in (select id from [uxxbs] where dj=1) group by adduser, danwei order by count(id) desc"
回复
发动态
发帖子
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
社区公告
暂无公告