Since you are looking to bring it on the same line you would need a group by in that.SELECT Person_name,Max(CASE WHEN phone_location IN (1,2) THEN Phone_number ELSE null END) AS [Home Phone],Max(CASE WHEN phone_location IN (4,5) THEN Phone_number ELSE null END) AS [Cell Phone],max(CASE WHEN phone_location IN (6,7) THEN Phone_number ELSE null END) AS [Work Phone]FROM PhoneNumbergroup by Person_Name
or you can do with a pivot, or joinSelect a.Person_name,a.Phone_location as Home,cell.Phone_Location as Cell, work.Phone_location as Work fromFROM PhoneNumber aleft join( select * from phonenumber aa and aa.phone_location IN (4,5)) cellon a.Person_Name = cell.Person_Nameleft join( select * from phonenumber aa and aa.phone_location IN (6,7)) workon a.Person_Name = work.Person_Namewhere a.Phone_Location in (1,2)
Success is 10% Intelligence, 70% Determination, and 22% Stupidity.\_/ _/ _/\_/ _/\_/ _/ _/- 881