zoukankan      html  css  js  c++  java
  • 筛选功能的实现

    用户表---   user  
       
      uid       username  
      1           user1  
      2           user2  
      3           user3  
      .........  
       
      数据表1---     table1  
       
      id     useranme     a     b     c     d  
      1         user1         1     1     1     1  
      2         user1         1     1     1     1  
      3         user2         1     1     1     1  
      4         user3         1     1     1     1  
      5         user2         1     1     1     1  
      6         user3         1     1     1     1  
       
      数据表2   ----table2  
      id     username     suma     sumb     sumc     sumd  

      select   username,suma=sum(a),sumb=sum(b),subc=sum(c),subd=sum(d)   from   table1   aa  
      where   exists(   select   *   from   user1   where   username=aa.username)  
      group   by   username 

       
      select   u.username,suma=sum(a),sumb=sum(b),subc=sum(c),subd=sum(d)  
      from ((select   *   from   user1) as u inner join  table1 on  u.username=table1.username)
       group   by   u.username  

  • 相关阅读:
    9.过滤器的使用
    8.公共组件
    7.Props向子组件传递数据
    6.组件
    5.指令系统-事件
    4.指令系统
    SpringCloud入门
    springcloud注解
    was unable to refresh its cache! status = Cannot execute request on any known server
    集成第三方框架,报错NoSuchFieldError:logger
  • 原文地址:https://www.cnblogs.com/ZhengGuoQing/p/1050577.html
Copyright © 2011-2022 走看看