• I believe you can get rid of the table variables altogether. Add the inner join used to populate the second table variable to the beginning of the first query to populate the first table variable and then add the additional "WHERE" clauses in the final query.