Sql server query optimization

shape