取相同数据的第一行(ROW_NUMBER的使用)
select *,ROW_NUMBER() OVER(PARTITION BY FItemID ORDER BY FOrderPrice) as num into #t1 from ICStockBillEntry where finterid=@interid
-- select * into #t2 from #t1 where num=1
select *,ROW_NUMBER() OVER(PARTITION BY FItemID ORDER BY FOrderPrice) as num into #t1 from ICStockBillEntry where finterid=@interid
-- select * into #t2 from #t1 where num=1