DECLARE @TableVariable TABLE (Id INT) INSERT INTO @TableVariable SELECT Id FROM TableName WHERE.... SELECT * FROM TableName WHERE Id IN ( SELECT Id FROM @TableVariable)