免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2043 | 回复: 1
打印 上一主题 下一主题

怎么把count(compno)也加入到结果中 谢谢 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-08-01 20:21 |只看该作者 |倒序浏览
本帖最后由 reiyangbo 于 2012-08-01 20:22 编辑

select a.cardno, c.nodetag,b.compname,a.cardholder,d.content,a.identifyno,b.telphno,b.compaddrs,b.taxno
from cardinfor a,cardcompinfor b,nodeinfor c,id_type d
where a.pri_card='1'
and a. cardstatus='04'
and a.compno=b.compno
and a.nodeno=c.nodeno
and a.identitytype=d.code
and a.compno in (select compno from cardinfor where cardstatus='04' group by compno having count(compno)>100)
如何在结果中加入count(compno)列  (count(compno)>100)

论坛徽章:
7
数据库技术版块每日发帖之星
日期:2015-08-09 06:20:00数据库技术版块每日发帖之星
日期:2015-11-03 06:20:00数据库技术版块每日发帖之星
日期:2016-02-20 06:20:00数据库技术版块每日发帖之星
日期:2016-07-13 06:20:00数据库技术版块每日发帖之星
日期:2016-07-31 06:20:00数据库技术版块每日发帖之星
日期:2016-08-01 06:20:00数据库技术版块每日发帖之星
日期:2016-08-18 06:20:00
2 [报告]
发表于 2012-08-02 08:16 |只看该作者
本帖最后由 Eisen 于 2012-08-02 08:16 编辑

select a.cardno, c.nodetag,b.compname,a.cardholder,d.content,a.identifyno,b.telphno,b.compaddrs,b.taxno,count(e.compno)
from cardinfor a,cardcompinfor b,nodeinfor c,id_type d,(select compno from cardinfor where cardstatus='04' group by compno having count(compno)>100) e
where a.pri_card='1'
and a. cardstatus='04'
and a.compno=b.compno
and a.nodeno=c.nodeno
and a.identitytype=d.code
and a.compno = e.compno
group by a.cardno, c.nodetag,b.compname,a.cardholder,d.content,a.identifyno,b.telphno,b.compaddrs,b.taxno
这样行不行?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP