取相同数据的第一行(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

posted @ 2012-09-25 13:29  niky  阅读(729)  评论(0编辑  收藏  举报