Here is my query...SELECT O.Product, O.Grade, O.ProdWkYr, O.CustNo, O.OrdLength, O.PcsOrdered - isnull(R.AppPieces, 0) as PcsOrdered, R.AppPieces, O.SpecialReq, O.PatternCut, (O.PatternCut + O.FinishCut) - (O.PcsOrdered - isnull(R.AppPieces, 0)) As PcsDiff, O.FinishCut, O.SpecialOrder, O.CharpyTest, isnull((case when R.AppPieces > 0 then case when R.CharpyTest = 'N' thencase when O.OrdLength = R.AppLength thenO.PcsOrdered - R.AppPieceselse null end else null end else null end),0) AS DSFrom NYS2ProductOrder O Left Join (NYS2ProductReApp R Inner Join cmnFullSpecs F on R.Grade = F.GradeCode) on O.Product = R.Product andO.Grade = F.GradeName And O.ProdWkYr = R.ProdWkYr And O.CustNo = R.CustNo and O.OrdLength = R.AppLengthWhere O.Product = 'W18X130' And O.Grade = 'A992' AND O.ProdWkYr = 915 And (O.PcsOrdered - isnull(R.AppPieces, 0)) > 0 ORDER BY o.SpecialReq, O.OrdLength, O.CustNo DESC
Within these tables, R.AppPieces = 2R.CharpyTest = "N"Lengths match...etc.The column "DS" should come up with 2, but I am getting 0 with everything I've tried.Any notions???Thanks,Obfuscated beyond repair.