I am new to Snowflake and trying to use a set variable to call a column name. Here’s what I’m currently trying:
set macro = 'Aut_24';
Select *
from my_data1 a
left join mydata2 b on a.id = b.id
where CAST("b.Column_name_$macro_value" AS DECIMAL(15,2)) >= 50
But I get the error “Invalid Identifier”. Does anyone know how to fix this?