找出某个型号对应最高版本

---------找出某个型号对应最高版本-----------
SELECT distinct *
into #temp1
FROM [fp_db].[dbo].[mktxhglb]
where substring(pdctno,2,4) = 'ABWQ'

select distinct *
into #temp2
from #temp1 a
where not exists (select * from #temp1 where substring(PdctNo,1,8)=substring(a.PdctNo,1,8) and PdctNo>a.PdctNo)

select pdctno from #temp2

posted @ 2021-11-25 19:58  顺时针KEY  阅读(86)  评论(0编辑  收藏  举报