select a,b,c, count(*) over(),avg(a) over() from t

解决方案 »

  1.   

    我的意思是count(*),avg(a)只要一个值就行了。
      

  2.   

    select a,b,c from table where x=y 比如返回有3条记录
    那么有9个值,再加上行数为3,平均数比方为5;
    那么我可以把结果集放在一个集合里,前9个为 select a,b,c from table where x=y返回的值,
    在接下去就是3,5。
    我的表达能力实在是太差了,不好意思!
      

  3.   

    select a from t
     union all 
    select a from t
     union all
    select c from t
    union all
    select count(*) from t
    union all
    selct avg(a) from t
      

  4.   

    select a from t where x= y
     union all 
    select b from t where x= y
     union all
    select c from t where x= y
    union all
    select count(*) from t
    union all
    selct avg(a) from t
      

  5.   

    如果用存储过程,那么结果你要用什么形式返回呢,是返回游标吗?如果用一句SQL就是
    select a from tb where x=y union all
    select b from tb where x=y union all
    select c from tb where x=y union all
    select count(*) from tb union all
    select avg(a) from tb;