首页 > 代码库 > sql中比较大小

sql中比较大小

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

sql中比较大小