参考(直接基于表的一步结果,输入月份时只能输月份的两位数字):
PARAMETERS [请输入月份] Text ( 255 );
SELECT 疾病编号, Sum(去年) AS 08年数, Sum(当年) AS 09数
FROM [seLECT 疾病编号, Format([诊断时间],"mm") & "月" AS 月份, Count(ID) AS 当年,0 as 去年
FROM 当年传染病数据
GROUP BY 疾病编号, Format([诊断时间],"mm") & "月"
union
seLECT 疾病编号, Format([诊断时间],"mm") & "月" AS 月份, 0 AS 当年,Count(ID) as 去年
FROM 去年传染病数据
GROUP BY 疾病编号, Format([诊断时间],"mm") & "月"]. AS [%$##@_Alias]
WHERE (((月份)=[请输入月份] & "月"))
GROUP BY 疾病编号;作者: cyj759 时间: 2009-9-29 14:01
大虾,能否传个附件,具体点,好吗?我是新手。