Use where clause with variable

--use where clause with variable DECLARE @basetable TABLE(id INT) INSERT into @basetable ( id ) VALUES (0) INSERT into @basetable ( id ) VALUES (1) INSERT into @basetable ( id ) VALUES (2) DECLARE @filtertable TABLE(id INT) INSERT into @filtertable ( id ) VALUES (0) INSERT into @filtertable ( id ) VALUES (2) --the magic happens here SELECT * FROM @basetable WHERE id IN (SELECT id FROM @filtertable)

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.