select _artist.id , _artist.fname , _artist.lname , _artist.display_name , _artist.is_active , _photo.id as idPhoto , _photo.thumb_image , _photo.thumb_width , _photo.thumb_height from _artist left join _photo on _photo.id = (select top 1 idPhoto from _artist_detail_photo where idArtist = _artist.id order by newid() desc) where _artist.id in ( select #artists.id from #artists ) order by _artist.display_name asc