首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 企业软件 > 行业软件 >

怎么实现如下的交叉表?(急求!)

2012-04-01 
如何实现如下的交叉表?(急求!!!!!!!!!!)ifexists(select*fromdbo.sysobjectswhereidobject_id(N [tb] )an

如何实现如下的交叉表?(急求!!!!!!!!!!)
if   exists   (select   *   from   dbo.sysobjects   where   id   =   object_id(N '[tb] ')   and   OBJECTPROPERTY(id,   N 'IsUserTable ')   =   1)
drop   table   [tb]
GO


create   table   tb(projectid   varchar(10),   6d   varchar(10),   model   varchar(10),   qty   int)
insert   into   tb
  select   'P1 ',     '6DA ', 'A ',1
  union   all   select   'P1 ',     '6DA ', 'B ',2
  union   all   select   'P1 ',     '6DA ', 'C ',3
  union   all   select   'P1 ',     '6DB ', 'D ',4
  union   all   select   'P1 ',     '6DB ', 'E ',5
  union   all   select   'P1 ',     '6DC ', 'F ',6

  union   all   select   'P2 ',     '6DA ', 'G ',7
  union   all   select   'P2 ',     '6DB ', 'H ',8
  union   all   select   'P2 ',     '6DD ', 'I ',9

  union   all   select   'P3 ',     '6DC ', 'J ',10
  union   all   select   'P3 ',     '6DD ', 'K ',11
  union   all   select   'P3 ',     '6DE ', 'L ',12

---------------------
如何实现显示下面的结果:

---------------------
-------|-----------------------------
              |                   6DA                 |             6DB             |         6DC       |         6DD       |   6DE   |
Project|--------------------|---------------|----------|----------|-----|
              |     A         B         C         G     |     D         E         H     |     F         J     |     I         K     |     L     |
------------------------------------|
    P1       |     1         2         3         0     |     4         5         0     |     0         0     |     0         0     |     0     |
    P2       |     0         0         0         7     |     0         0         8     |     0         0     |     9         0     |     0     |


    P3       |     0         0         0         0     |     0         0         0     |     0         10   |     0         11   |     12   |
-------------------------------------  




[解决办法]
是Reporting Service?可以用矩阵来实现。
[解决办法]
可以用 http://www.finereport.com 来做
[解决办法]
呵呵,用水晶报表,一分钟搞定.这是我做出来的,不过复制过来没有表格了.
6DAABCGDEHFJIKL
P11.002.003.00.004.005.00.006.00.00.00.00.00
P2.00.00.007.00.00.008.00.00.009.00.00.00
P3.00.00.00.00.00.00.00.0010.00.0011.0012.00
[解决办法]
http://www.xdesigner.cn/_yuansreport.aspx

热点排行