|
原帖由 抹香鲸2009 于 2010-5-29 16:32 发表
楼主的题目表达不清楚。那个a1单元格的1只能作为第一列标题,不可能即作列标题,又作行标题。所以楼主给出的样表有些问题。不过,我猜大致意思是要求2-14列的数据汇总。引入外部查询,SQL语句如下:
select [1],"2" ...
SQL语句改为这个就可以的:- select a.F1 as [类别],"1" as 目 from [源数据$a1:n34] a union all
- select F2,"2" as 目 from [源数据$a1:n34] union all
- select F3,"3" as 目 from [源数据$a1:n34] union all
- select F4,"4" as 目 from [源数据$a1:n34] union all
- select F5,"5" as 目 from [源数据$a1:n34] union all
- select F6,"6" as 目 from [源数据$a1:n34] union all
- select F7,"7" as 目 from [源数据$a1:n34] union all
- select F8,"8" as 目 from [源数据$a1:n34] union all
- select F9,"9" as 目 from [源数据$a1:n34] union all
- select F10,"10" as 目 from [源数据$a1:n34] union all
- select F11,"11" as 目 from [源数据$a1:n34] union all
- select F12,"12" as 目 from [源数据$a1:n34] union all
- select F13,"13" as 目 from [源数据$a1:n34] union all
- select F14,"14" as 目 from [源数据$a1:n34]
复制代码 我的附件有一个小问题,SQL查询结果在一个中间表里:
测试.rar
(9.98 KB, 下载次数: 13)
[ 本帖最后由 whsfhwm 于 2010-5-31 11:10 编辑 ] |
|