国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

找出缺數據的月份

2024-07-21 02:50:06
字體:
來源:轉載
供稿:網友
找出缺數據的月份
declare @last table(year1 varchar(100),companycode1 varchar(100),lastmonth varchar(100))
declare @now  table(year varchar(100),companycode varchar(100), month varchar(100))
declare @temp table(month varchar(100));
declare @year int
set @year=2009
insert into @temp (month) values('01');
insert into @temp (month) values('02');
insert into @temp (month) values('03');
insert into @temp (month) values('04');
insert into @temp (month) values('05');
insert into @temp (month) values('06');
insert into @temp (month) values('07');
insert into @temp (month) values('08');
insert into @temp (month) values('09');
insert into @temp (month) values('10');
insert into @temp (month) values('11');
insert into @temp (month) values('12');
insert into @last   
select * from (
select Year,companycode   from
ACV_Gr with(nolock) where [year]=@year  GROUP BY companycode,Year 
)a inner join @temp t on 1=1
PRint 1
--select * from @last order by companycode1,lastmonth
insert into @now 
select Year,companycode,Month=substring('0'+month,len(month) ,5)     from
ACV_BookDetail_2009 with(nolock) where [year]=@year  GROUP BY companycode,Year,Month
--select * from @now order by companycode,month
print 2
delete  @last   where exists(select * from @now a where a.year= YEAR1 AND a.companycode= companycode1 and a.month=lastmonth)
select * from  @last order by companycode1,lastmonth

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 拉孜县| 东源县| 焦作市| 汉川市| 新疆| 九龙县| 盐山县| 宿松县| 略阳县| 扶余县| 政和县| 图们市| 井陉县| 陇川县| 开鲁县| 绩溪县| 汝南县| 安宁市| 鄄城县| 新和县| 巩义市| 红原县| 宜都市| 沁水县| 泾川县| 定远县| 张北县| 靖江市| 富顺县| 连州市| 新巴尔虎右旗| 特克斯县| 宝坻区| 吉木乃县| 左权县| 延庆县| 开平市| 漾濞| 左权县| 安溪县| 泸水县|