我有一个非常简单的交叉表报告,该报告工作正常但只有一个小问题。
我的Sql看起来像这样
我将这些组应用于我的Crystal Report交叉表并显示为以下行:
行
类型 - > Ggroup - >子组 - > projectname - >子项目
列
colName和date
汇总字段
价值之和
我的问题可以在水晶报告的快照中看到
我理解为什么我有这些空行,因为它们显示'子项目'...但是......但是......数据库中的'NULL',甚至不应该显示在此报告中。如果'SubProjects'为NULL,只是不显示它们,而是显示'projectname'。
有没有办法去探索?
由于
P.S。 这是我用于生成此表的SQL脚本
CREATE TABLE [dbo].[test](
[id] [bigint] IDENTITY(1,1) NOT NULL,
[Type] [nvarchar](150) NULL,
[Ggroup] [nvarchar](150) NULL,
[SubGroup] [nvarchar](150) NULL,
[projectname] [nvarchar](150) NULL,
[SubProject] [nvarchar](150) NULL,
[colName] [nvarchar](150) NULL,
[date] [datetime] NULL,
[Value] [decimal](18, 0) NULL,
CONSTRAINT [PK_test] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo].[test] ON
GO
INSERT [dbo].[test] ([id], [Type], [Ggroup], [SubGroup], [projectname], [SubProject], [colName], [date], [Value]) VALUES (15, N'Program New
', N'INSTALLATIONS GENERALES
', NULL, N'Bitumage Studios Zone 9000
', NULL, N'Cost', CAST(0x0000A3E100000000 AS DateTime), CAST(123 AS Decimal(18, 0)))
GO
INSERT [dbo].[test] ([id], [Type], [Ggroup], [SubGroup], [projectname], [SubProject], [colName], [date], [Value]) VALUES (16, N'Program New
', N'INSTALLATIONS GENERALES
', NULL, N'Etude et Réalisation Etanchiété des Magasins
', NULL, N'Cost', CAST(0x0000A3E100000000 AS DateTime), CAST(321 AS Decimal(18, 0)))
GO
INSERT [dbo].[test] ([id], [Type], [Ggroup], [SubGroup], [projectname], [SubProject], [colName], [date], [Value]) VALUES (17, N'Program New
', N'INSTALLATIONS GENERALES
', NULL, N'Etude Réseau Modulation Centralisée
', NULL, N'Cost', CAST(0x0000A3E100000000 AS DateTime), CAST(666 AS Decimal(18, 0)))
GO
INSERT [dbo].[test] ([id], [Type], [Ggroup], [SubGroup], [projectname], [SubProject], [colName], [date], [Value]) VALUES (18, N'Program New
', N'INSTALLATIONS GENERALES
', NULL, N'Abris pour Véhicules ( 150 places )
', N'Réseau Anti-Incendie
', N'Cost', CAST(0x0000A3E100000000 AS DateTime), CAST(888 AS Decimal(18, 0)))
GO
INSERT [dbo].[test] ([id], [Type], [Ggroup], [SubGroup], [projectname], [SubProject], [colName], [date], [Value]) VALUES (19, N'Program New
', N'INSTALLATIONS GENERALES
', NULL, N'Abris pour Véhicules ( 150 places )
', N'Système de Signalisation de Sécurité
', N'Cost', CAST(0x0000A3E100000000 AS DateTime), CAST(999 AS Decimal(18, 0)))
GO
INSERT [dbo].[test] ([id], [Type], [Ggroup], [SubGroup], [projectname], [SubProject], [colName], [date], [Value]) VALUES (20, N'Program New
', N'INSTALLATIONS GENERALES
', NULL, N'Abris pour Véhicules ( 150 places )
', N'Acquisition et Installation D''un Auto-Commutateur *PABX
', N'Cost', CAST(0x0000A3E100000000 AS DateTime), CAST(457 AS Decimal(18, 0)))
GO
INSERT [dbo].[test] ([id], [Type], [Ggroup], [SubGroup], [projectname], [SubProject], [colName], [date], [Value]) VALUES (21, N'Program New
', N'INFRASTRUCTURES SOCIALES
', NULL, N'164 Studios
', NULL, N'Cost', CAST(0x0000A3E100000000 AS DateTime), CAST(365 AS Decimal(18, 0)))
GO
INSERT [dbo].[test] ([id], [Type], [Ggroup], [SubGroup], [projectname], [SubProject], [colName], [date], [Value]) VALUES (22, N'Program New
', N'INFRASTRUCTURES SOCIALES
', NULL, N'Rénovation Cabines Chantiers
', NULL, N'Cost', CAST(0x0000A3E100000000 AS DateTime), CAST(489 AS Decimal(18, 0)))
GO
INSERT [dbo].[test] ([id], [Type], [Ggroup], [SubGroup], [projectname], [SubProject], [colName], [date], [Value]) VALUES (31, N'Program New
', N'INFRASTRUCTURES SOCIALES
', NULL, N'164 Studios
', NULL, N'Cost', CAST(0x0000A3D700000000 AS DateTime), CAST(989 AS Decimal(18, 0)))
GO
INSERT [dbo].[test] ([id], [Type], [Ggroup], [SubGroup], [projectname], [SubProject], [colName], [date], [Value]) VALUES (32, N'Program New
', N'INFRASTRUCTURES SOCIALES
', NULL, N'164 Studios
', NULL, N'Realisation', CAST(0x0000A3D700000000 AS DateTime), CAST(555 AS Decimal(18, 0)))
GO
SET IDENTITY_INSERT [dbo].[test] OFF
GO