用存贮过程。
每一个count(*)的值用一个输出参数来产生。程序调用后处理这些输出参数就是了。create procedure count_all
(
@count1 int output,
@count2 int output,
@count3 int output
)as
select @count1=count(*) from table1 where type=1;
select @count2=count(*) from table1 where type=2;
select @count3=count(*) from table1 where type<>1 and type <>2;Go
每一个count(*)的值用一个输出参数来产生。程序调用后处理这些输出参数就是了。create procedure count_all
(
@count1 int output,
@count2 int output,
@count3 int output
)as
select @count1=count(*) from table1 where type=1;
select @count2=count(*) from table1 where type=2;
select @count3=count(*) from table1 where type<>1 and type <>2;Go
然后函数 中 用循环 构造 sql 语句,查询,将 结果放到 一个数组中,返回这个数组即可
1.手动写一个dataset,dataset里边的表自定义用element生成(但是
数据库里边并没有这个表)
2.将N个COUNT
1.手动写一个dataset,dataset里边的表自定义用element生成(但是
数据库里边并没有这个表)
2.将N个COUNT结果放到一个数组里,然后将数组数据插入到dataset的
表中
3.用report调用dataset里边表的数据我就是实现不了,楼上的几位麻烦你们再帮着想想。