Is this what you want? BTW, why does the same Student_ID have 3 different names?declare @yourTable table (Student_ID int, Name varchar(20), Type varchar(20), Product varchar(20))insert @yourTableselect 10001, 'David', 'Virtual', 'Infra' union allselect 10002, 'Troy', 'Hardware', 'Solution' union allselect 10002, 'Elizabeth', 'Core', 'Server' union allselect 10003, 'Karen', 'Windows', 'Solution' union allselect 10002, 'Tony', 'messaging', 'Software' union allselect 10004, 'Loren', 'Hardware', 'Server' union allselect 10004, 'Katty', 'messaging', 'Solution'update y set type = 'Virtual'from ( select student_id from @yourTable where [type] = 'Hardware' and product = 'Solution' group by student_id ) djoin @yourTable as y on y.student_id = d.student_idselect * from @yourTableOUTPUT:Student_ID Name Type Product----------- -------------------- -------------------- --------------------10001 David Virtual Infra10002 Troy Virtual Solution10002 Elizabeth Virtual Server10003 Karen Windows Solution10002 Tony Virtual Software10004 Loren Hardware Server10004 Katty messaging Solution
Be One with the OptimizerTG