SELECT P.PartsFamilyID, P.PackageID, R.RoHSStatus FROM Parts.ManufacturingData M WITH(NOLOCK) INNER JOIN Parts.Nop_Part P WITH(NOLOCK) ON P.PartID = M.PartID INNER JOIN Parts.ROHS R WITH(NOLOCK) ON R.ZPartID = P.PartID where packageId is not null GROUP BY P.PartsFamilyID, P.PackageID, R.RoHSStatus HAVING COUNT(DISTINCT M.LeadFinishPlatingID) > 1 OR COUNT(DISTINCT M.BaseMaterialID) > 1
with ctemanufacture as ( ) select * into #test from rn1 > 1 or rn2>1 so please How can i do that please ?
SELECT ... FROM ( SELECT P.PartsFamilyID, P.PackageID, R.RoHSStatus, COUNT(*) OVER(PARTITION BY M.LeadFinishPlatingID ORDER BY ...) AS Cnt1, COUNT(*) OVER(PARTITION BY M.BaseMaterialID ORDER BY ...) AS Cnt2 FROM ... ) AS T WHERE T.Cnt1>1 OR Cnt2>1
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)