有关PIVOT查询的帮助
我有一个具有以下结构的表: CREATE TABLE [dbo].[AUDIT_SCHEMA_VERSION]( [SCHEMA_VER_MAJOR] [int] NOT NULL, [SCHEMA_VER_MINOR] [int] NOT NULL, [SCHEMA_VER_SUB] [int] NOT NULL, [SCHEMA_VER_DATE] [datetime] NOT NULL, [SCHEMA_VER_REMARK] [varchar](250) NULL ); 一些示例数据(似乎是sqlfiddle的问题。因此,请放置一些示例数据): INSERT INTO [AUDIT_SCHEMA_VERSION]([SCHEMA_VER_MAJOR],[SCHEMA_VER_MINOR],[SCHEMA_VER_SUB],[SCHEMA_VER_DATE],[SCHEMA_VER_REMARK]) VALUES(1,6,13,CAST('20130405 04:41:25.000' as DATETIME),'Stored procedure build') INSERT INTO [AUDIT_SCHEMA_VERSION]([SCHEMA_VER_MAJOR],[SCHEMA_VER_MINOR],[SCHEMA_VER_SUB],[SCHEMA_VER_DATE],[SCHEMA_VER_REMARK]) VALUES(1,6,13,CAST('20130405 04:41:25.000' as DATETIME),'Stored procedure build') INSERT INTO [AUDIT_SCHEMA_VERSION]([SCHEMA_VER_MAJOR],[SCHEMA_VER_MINOR],[SCHEMA_VER_SUB],[SCHEMA_VER_DATE],[SCHEMA_VER_REMARK]) VALUES(1,7,13,CAST('20130405 04:41:25.000' as DATETIME),'Stored …