标签:ar new as sql type table rom select date
if object_id(‘tempdb..#dataOldNew1‘) is not null drop table #dataOldNew1
select
distinct store_cd
,item_cd
, ItemType
, CompStoreNM
, CompPrice
-- , CompStandardNum
-- , CompBrandNM
, CreateDate
into
#dataOldNew1
from
#alldata as a
where
(
select count(o) from #alldata as b
where
a.item_cd=b.item_cd
and
a.store_cd=b.store_Cd
and
a.CompStoreNM=b.CompStoreNM
and
a.inum<b.inum
--a.createdate<b.createdate
)<1
标签:ar new as sql type table rom select date
原文地址:http://www.cnblogs.com/zigewb/p/4039924.html