国产探花免费观看_亚洲丰满少妇自慰呻吟_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

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 日土县| 东辽县| 梅河口市| 来安县| 元氏县| 林周县| 广饶县| 昭通市| 武夷山市| 宕昌县| 十堰市| 临漳县| 濮阳县| 黄浦区| 攀枝花市| 嘉荫县| 嘉荫县| 疏附县| 灵璧县| 新野县| 清流县| 湟源县| 修水县| 丹棱县| 墨竹工卡县| 陇南市| 诸城市| 岢岚县| 永胜县| 龙泉市| 嘉峪关市| 萍乡市| 安顺市| 会宁县| 双城市| 扶沟县| 镇平县| 虹口区| 晋宁县| 新宁县| 永兴县|