您的位置:首页 > 博客中心 > 数据库 >

sql中比较大小

时间:2022-03-14 01:19

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

热门排行

今日推荐

热门手游