I have the following query:
select * from cars where make in (\'BMW\', \'Toyota\', \'Nissan\')
What I want to do is store the where param
Use CTE for storing multiple values into a single variable.
;WITH DATA1 AS ( select car_name from cars where make in ('BMW', 'Toyota', 'Nissan') ) SELECT @car_name = CONCAT(@car_name,',',car_name) FROM DATA1 select @car_name