以下實作是為了顯示各分公司各部門的事病假報表
- DataSet T-SQL 語法
USE [AdventureWorks2012]
GO
IF OBJECT_ID('Leave') IS NOT NULL
DROP TABLE Leave
CREATE TABLE Leave (Branch nchar(4) , DepName nchar(20) , EmpName nchar(20) , personal numeric(4,1) , Sick numeric(4,1))
INSERT INTO Leave (Branch,DepName,EmpName,Personal,Sick) VALUES
(N'台北',N'MIS',N'MIS-1',0.0,0.0) ,
(N'台北',N'MIS',N'MIS-2',8.0,8.0) ,
(N'台北',N'HR',N'HR-1',8.0,0.0) ,
(N'台中',N'Sales',N'Sales-1',0.0,4.0) ,
(N'台中',N'Sales',N'Slaes-2',8.0,8.0) ,
(N'台中',N'Marketing',N'Marking-1',8.0,4.0) ,
(N'高雄',N'Accounting',N'Accounting-1',0.0,0.0) ,
(N'高雄',N'Accounting',N'Accounting-2',0.0,0.0) ,
(N'高雄',N'Accounting',N'Accounting-3',0.0,0.0) ,
(N'高雄',N'Design',N'Design-1',0.0,0.0) ,
(N'高雄',N'Design',N'Design-2',0.0,0.0)