If it's always three images you do like this:-- test tablecreate table #ib (Id int, FileName varchar(100), Image varchar(15), EventId int, EventExtraId int)-- test datainsert #ib values (1, '1_1.jpg', 'binary data', 4, 1)insert #ib values (2, '1_2.jpg', 'binary data', 4, 1)insert #ib values (3, '1_3.jpg', 'binary data', 4, 1)select i1.FileName AS FileName1, i1.Image AS Image1, i2.FileName AS FileName2, i2.Image AS Image2, i3.FileName AS FileName3, i3.Image AS Image3from #ib i1 cross apply ( select FileName, Image from #ib where id = 2 ) as i2 cross apply ( select FileName, Image from #ib where id = 3 ) as i3where id = 1
Reporting & Analysis Specialist