I want set a select list as variable and do some conditional check on it:
This is my code which is not working:
set @temp = (select docId from table_1);
SELECT
id,
CASE when id IN (@temp) then 'TRUE' else 'FALSE' end as visited
FROM table_2;
Also tried this:
set @temp = (select docId from table_1);
SELECT
id,
CASE when (FIND_IN_SET(id,@temp)=1) then 'TRUE' else 'FALSE' end as visited
FROM table_2;
In both case, visited column is coming FALSE for each row.
select docId from table_1