* 6楼吹版主的方法,巧妙
SELECT * FROM zbb INTO ARRAY arr
DIMENSION arr[ALEN(arr,1)*ALEN(arr,2),1]
CREATE CURSOR tmp (姓名 v(10))
INSERT INTO tmp FROM ARRAY arr
SELECT 姓名,COUNT(*) 值班天数 FROM tmp GROUP BY 姓名 ORDER BY 姓名
* 我想的方法是,把7个连起来
select t1.姓名,count(1) 次数 from (;
select Oct_1 as 姓名 from zbb;
union all;
select Oct_2 as 姓名 from zbb;
union all;
select Oct_3 as 姓名 from zbb;
union all;
select Oct_4 as 姓名 from zbb;
union all;
select Oct_5 as 姓名 from zbb;
union all;
select Oct_6 as 姓名 from zbb;
union all;
select Oct_7 as 姓名 from zbb) t1;
group by t1.姓名 order by t1.姓名 into cursor tmp
brow
SELECT * FROM zbb INTO ARRAY arr
DIMENSION arr[ALEN(arr,1)*ALEN(arr,2),1]
CREATE CURSOR tmp (姓名 v(10))
INSERT INTO tmp FROM ARRAY arr
SELECT 姓名,COUNT(*) 值班天数 FROM tmp GROUP BY 姓名 ORDER BY 姓名
* 我想的方法是,把7个连起来
select t1.姓名,count(1) 次数 from (;
select Oct_1 as 姓名 from zbb;
union all;
select Oct_2 as 姓名 from zbb;
union all;
select Oct_3 as 姓名 from zbb;
union all;
select Oct_4 as 姓名 from zbb;
union all;
select Oct_5 as 姓名 from zbb;
union all;
select Oct_6 as 姓名 from zbb;
union all;
select Oct_7 as 姓名 from zbb) t1;
group by t1.姓名 order by t1.姓名 into cursor tmp
brow