下面是 mt 数据库表
CREATE TABLE [dbo].[mtblLog_Book](
[Logbook_Number] [int] IDENTITY(1,1) NOT NULL,
[Sno] [int] NULL,
[Vehicle_Number] [nvarchar](100) NULL,
[Vehicle_Booking_Date] [datetime] NULL,
[Time_From] [datetime] NULL,
[Time_To] [datetime] NULL,
[KM_Start] [int] NULL,
[KM_End] [int] NULL,
[Total] [int] NULL,
[Vehicle_Used_By] [varchar](100) NULL,
[Cost_Code] [nvarchar](50) NULL,
[Budget_Line] [nvarchar](50) NULL,
[Entry_Date] [datetime] NULL
) ON [PRIMARY]
有重复Cost_Code
。我需要一个查询,以便我可以获取以下格式的数据
CostCode1
......................
All data which belong to CostCode1
......................
CostCode2
......................
All data which belong to CostCode2
......................
CostCode3
......................
All data which belong to CostCode3
......................
继续.... 到 CostCode* n *
谢谢