问题解决。此段代码可以不要。谢谢S版主。完整代码如下:
程序代码:
CREATE CURSOR QYGM (企业规模 C(8),人数1 I,人数2 I,产值1 I,产值2 I)
INSERT INTO QYGM VALUES ([微型企业],0,20,0,300)
INSERT INTO QYGM VALUES ([小型企业],20,300,300,2000)
INSERT INTO QYGM VALUES ([中型企业],300,1000,2000,40000)
INSERT INTO QYGM VALUES ([大型企业],1000,999999,40000,999999999)
SELECT QYGM.企业规模 企业规模,CAST(COUNT(distinct Qyzycpk.jgmc) AS N(4)) 企业数,;
CAST(COUNT(QYZYCPK.ZYCP) AS N(4)) 产品数,;
CAST(SUM(IIF(QYZYCPK.BZDJ=[1],1,0)) AS N(4)) 国标,;
CAST(SUM(IIF(QYZYCPK.BZDJ=[2],1,0)) AS N(4)) 行标,;
CAST(SUM(IIF(QYZYCPK.BZDJ=[3],1,0)) AS N(4)) 地标,;
CAST(SUM(IIF(QYZYCPK.BZDJ=[4],1,0)) AS N(4)) 企标,;
CAST(SUM(IIF(QYZYCPK.BZDJ=[5],1,0)) AS N(4)) 协议,;
ROUND((CAST(SUM(IIF(QYZYCPK.BZDJ=[1],1,0)) AS N(4))+CAST(SUM(IIF(QYZYCPK.BZDJ=[2],1,0)) AS N(4))+;
CAST(SUM(IIF(QYZYCPK.BZDJ=[3],1,0)) AS N(4))+CAST(SUM(IIF(QYZYCPK.BZDJ=[4],1,0)) AS N(4))+;
CAST(SUM(IIF(QYZYCPK.BZDJ=[5],1,0)) AS N(4)))/(CAST(COUNT(QYZYCPK.ZYCP) AS N(4)))*100,2) 标准覆盖率 ;
FROM QYJBXXB ;
INNER JOIN QYZYCPK ON Qyjbxxb.jgdm = Qyzycpk.jgdm ;
INNER JOIN QYGM ;
ON (QYJBXXB.ZGRS>=QYGM.人数1 AND QYJBXXB.ZGRS<QYGM.人数2) AND (QYJBXXB.NCZ>=QYGM.产值1 AND QYJBXXB.NCZ<QYGM.产值2) ;
GROUP BY QYGM.企业规模 INTO CURSOR TEMP READWRITE
INSERT INTO TEMP SELECT [合计],SUM(企业数),SUM(产品数),SUM(国标),SUM(行标),SUM(地标),SUM(企标),SUM(协议),;
ROUND((SUM(国标)+SUM(行标)+SUM(地标)+SUM(企标)+SUM(协议))/SUM(产品数)*100,2) FROM TEMP
GO TOP
WITH THISFORM.GRID1
.COLUMNCOUNT=FCOUNT([TEMP])
.RECORDSOURCE=[TEMP]
FOR I=1 TO .COLUMNCOUNT
WITH .COLUMNS(I)
.WIDTH=IIF(I=1,168,IIF(i=thisform.grid1.columncount,100,48))
.HEADER1.CAPTION=FIELD(I)
.HEADER1.ALIGNMENT=2
.Resizable=.F.
ENDWITH
ENDFOR
ENDWITH
SET DATE YMD
thisform.text1.Value=date()
运行结果界面如下:
图片附件: 游客没有浏览图片的权限,请
登录 或
注册