- sql参考:
- SELECT 地区,审计,优良,数,审核,结果,"结果" AS 分类 FROM
- (SELECT *,"A审计结果" AS 结果 FROM
- (select count(优良) as 数,地区,审计,优良,审核 FROM
- (select 地区,"第一次审计时间" AS 审计,A审计结果 AS 优良,FORMAT(第一次审计时间,"YYYY-MM") AS 审核 FROM [sheet1$a1:j5]
- UNION ALL
- select 地区,"第二次审计时间",A审计结果1,FORMAT(第二次审计时间,"YYYY-MM") FROM [sheet1$a1:j5]
- union all
- select 地区,"第三次审计时间",A审计结果2,FORMAT(第三次审计时间,"YYYY-MM") FROM [sheet1$a1:j5])
- GROUP BY 地区,审计,优良,审核)
- UNION ALL
- SELECT *,"B审计结果" FROM
- (select count(优良) as 数,地区,审计,优良,审核 FROM
- (select 地区,"第一次审计时间" AS 审计,B审计结果 AS 优良,FORMAT(第一次审计时间,"YYYY-MM") AS 审核 FROM [sheet1$a1:j5] UNION ALL
- select 地区,"第二次审计时间",B审计结果1,FORMAT(第二次审计时间,"YYYY-MM") FROM [sheet1$a1:j5] union all
- select 地区,"第三次审计时间",B审计结果2,FORMAT(第三次审计时间,"YYYY-MM") FROM [sheet1$a1:j5] )
- GROUP BY 地区,审计,优良,审核))
- union all
- SElECT 地区,审计,"",数,审核,"","数量" FROM
- (select 地区,审计,count(审计) as 数,审核 FROM
- (select 地区,"第一次审计时间" AS 审计,FORMAT(第一次审计时间,"YYYY-MM") AS 审核 FROM [sheet1$a1:j5]
- UNION ALL
- select 地区,"第二次审计时间",FORMAT(第二次审计时间,"YYYY-MM") FROM [sheet1$a1:j5]
- union all
- select 地区,"第三次审计时间",FORMAT(第三次审计时间,"YYYY-MM") FROM [sheet1$a1:j5])
- GROUP BY 地区,审计,审核)
复制代码 这样应该更准确.
[ 本帖最后由 wuxiang_123 于 2010-3-6 12:02 编辑 ] |