首先对近来看这个帖子的各位我说声谢谢了,因为在csdn里面对没分的帖子大家一般都不会看的,好了说正题。。求一个这样的sql 语句
从session 里面区一个值 让a,b,c,d表里面的值得都等于这个
然后count()a,b,c,d表里面的信息,   在count(renzheng)a,b,c,d表里面的信息
也就是count()两次

解决方案 »

  1.   

    select count(*) from session where ****and****
      

  2.   

    看不明白,什么count()2次???
    count(renzheng)又是什么意思 ???
    从session 里面区一个值 让a,b,c,d表里面的值得都等于这个
     这个是在程序里面写的吧..
      

  3.   

    第一个count 是看一共有多少条数据 第2个count 是看看 批准发布的信息有多少条
      

  4.   

    "批准发布的信息"
    是不是有个字段是标识批准发布的啊?count(*)  --一共有多少条数据
    sum(case when renzheng='批准' then 1 else 0 end) --批准的有多少条
      

  5.   

    意思就是 当用户登陆以后 查看他在a  b  c  d  表里面的信息,
    看看 一共发多少条,和批准了多少条
      

  6.   

    第2个count 是看看 批准发布的信息有多少条
    select count(*) from tb where column='批准发布'
      

  7.   

    就是把这几个语句综合起来select count(*) from a where user_name = 'xuemiao'select count(*) from a where supply_authentication = 'y' and user_name = 'xuemiao'
    select count(*) from b where user_name = 'xuemiao'select count(*) from b where supply_authentication = 'y' and user_name = 'xuemiao'
    select count(*) from c where user_name = 'xuemiao'select count(*) from c where supply_authentication = 'y' and user_name = 'xuemiao'
    select count(*) from d where user_name = 'xuemiao'select count(*) from d where supply_authentication = 'y' and user_name = 'xuemiao'
      

  8.   

    kmiaoer(苗儿) ( ) 信誉:98    Blog   加为好友  2007-04-16 11:10:58  得分: 0  
     
     
       意思就是 当用户登陆以后 查看他在a  b  c  d  表里面的信息,
    看看 一共发多少条,和批准了多少条
      
    --------------------------------------------
    还是没说明白.
    a b c d是4个表吧?它们的关联关系是什么?
    1个用户的发布信息存在4个表里吗?
    批准了多少条是什么意思?用什么字段来表示是否批准?
      

  9.   

    select sum(total) as 'total',sum(supply_authentication) as 'supply_authentication' from (
    select count(*) as total,sum(case when supply_authentication='y' then 1 else 0 end) as supply_authentication from a where user_name = 'xuemiao'
    union all
    select count(*) as total,sum(case when supply_authentication='y' then 1 else 0 end) as supply_authentication from b where user_name = 'xuemiao'
    union all
    select count(*) as total,sum(case when supply_authentication='y' then 1 else 0 end) as supply_authentication from c where user_name = 'xuemiao'
    union all
    select count(*) as total,sum(case when supply_authentication='y' then 1 else 0 end) as supply_authentication from d where user_name = 'xuemiao'
    )t
      

  10.   

    意思就是 当用户登陆以后 查看他在a  b  c  d  表里面的信息,
    看看 一共发多少条,和批准了多少条
    select count(*) from (
    select user_name,supply_authentication from a 
    union all
    select user_name,supply_authentication from b
    union all
    select user_name,supply_authentication from c
    union all
    select user_name,supply_authentication from d)a
    where user_name = 'xuemiao' 和批准了多少条
    select count(*) from (
    select user_name,supply_authentication from a 
    union all
    select user_name,supply_authentication from b
    union all
    select user_name,supply_authentication from c
    union all
    select user_name,supply_authentication from d)a
    where user_name = 'xuemiao' and supply_authentication = 'y'
    是吗
      

  11.   

    如果是的话~~~下次别说count两次....说两条sql语句
      

  12.   

    从session 里面区一个值.....
    程序里的东西就不要说出来了~~害我丢人...