then replace phonenumber with actual concatenation expressionSELECT o.PhoneNumber,o.Completion_date,p.product_version,p.product_TypeFROM (SELECT *,npa || nxx || lineno || as PhoneNumber FROM Orders) oINNER JOIN (SELECT npa || nxx || lineno || as PhoneNumber,MAX(completion_date) AS latest FROM Orders GROUP BY npa || nxx || lineno || )o1ON o1.phonenumber = o.phonenumberAND o1.latest = o.completion_dateINNER JOIN Product pON p.product_version = o.product_version
Also this is MS SQL Server forum and i think you're using OracleI can guarantee above solution working in sql server but not in Oracleyou may make a try and if not working try this in some oracle forumsthere are not many Oracle experts here and I personally is not an expert------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/