当前位置:首页
开发技术指南» 文章正文
    引言:

    摘要: sql语句如下: select * from ((select * from bidquota where biddername=:biddername1) as a left join (select * from bidquota where biddername=biddername2) as b on (a.quotasno=b.quotasno) and (a.listno=b.......
 ·小问题,兄弟们帮忙看一下    »显示摘要«
    摘要: jdbc是怎么样处理事务的? ......


一条Sql的写法

表结构:部门,姓名,学历  
   
  想直接查询出如下结果:  
  部门       学历     人数  
  部门1     大学       2  
  部门1     中学       3  
  .....  
  部门n     ...         ...  
   
  合计     ....         ....  
              ....         ....

NO.1   作者: libin_ftsafe

select    
          部门   =   isnull(部门,合计),  
          学历,  
          人数=count(*)    
  from    
          表    
  group   by    
          部门,学历   with   rollup  
  having    
          grouping(学历)=0   or   grouping(部门)=1  
  order   by  
          部门,学历

NO.2   作者: samfeng_2003

select    
          部门   =   isnull(部门,合计),  
          学历,  
          人数=sum(人数)    
  from    
          表  
  group   by    
          部门,学历   with   rollup  
  having    
          grouping(学历)=0   or   grouping(部门)=1  
  order   by  
          部门,学历  
   
  要把红尘兄的count(*)   改sum就可以了!题是红尘兄做出来的,可别忘记给分给他哈!:)


    摘要: 不知道大家有没有出现这个问题,局域网是好的,并且我连接到其它机子上的sql服务也是好的,其它人连接到我们的服务器上时也是好的! 为什么我就是连接不上去: 错误提示: 无法链接到erpwebserver odbc:消息 0 级别 16 状态 1 [microsoft][odbc sql server driver]通讯链接失败 ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE