Viewing 4 posts - 1 through 4 (of 4 total)
Please check this query:
;WITH CTE AS
(
SELECT *,RANK()OVER(PARTITION BY GivenPartNumber_Non,vcompanyid ORDER BY SourceType) Rank_ASC
,RANK()OVER(PARTITION BY GivenPartNumber_Non,vcompanyid ORDER BY SourceType DESC) Rank_DESC
FROM #notmappedsources
)SELECT GivenPartNumber_Non, vcompanyid,SourceType
FROM CTE
WHERE SourceType = 484456 AND Rank_ASC=Rank_DESC
March 9, 2022 at 7:14 am
Viewing 4 posts - 1 through 4 (of 4 total)