年假调休日期应与年度的记录对应
大家好!
在此有一个问题需要大家帮忙,请大家看附件图片的说明。
以下为SQL代码
-----年假年度数表CREATE TABLE [dbo].[AV]( [employeeid] [int] NULL, [yearmonth] [datetime] NULL, [Havenumber] [int] NULL, [Overnumber] [int] NULL, [Oddnumber] [int] NULL, [sta] [nchar](10) NULL) ON [PRIMARY]-----年假调休表CREATE TABLE [dbo].[AVDetail]( [Id] [int] NOT NULL, [Employeeid] [int] NULL, [XJDate] [datetime] NULL, [XJnumber] [int] NULL) ON [PRIMARY]----插入年假总数据表 AV年假总数insert into avselect 1,'2011-01-01',20,0,20,nullunionselect 1,'2012-01-01',10,0,10,nullunion select 3,'2011-01-01',20,0,20,nullunionselect 3,'2012-01-01',10,0,10,nullinsert into dbo.AVDetailselect 1,1,'2011-12-02',4union select 2,1,'2011-12-03',4union select 3,1,'2011-12-05',8union select 4,1,'2011-12-08',8union select 5,1,'2011-12-08',8union select 6,3,'2011-12-08',8unionselect 7,3,'2011-12-05',8union select 8,3,'2011-12-08',8union select 9,3,'2011-12-08',8union select 10,3,'2011-12-08',8