Store raws as query results into a single variable or array at PostgreSQL

Viewed 16

Language: SQL from PostgreSQL in Amazon Redshift; Editor: Dbeaver Community

Hello guys! I saw the example here in the community from how to declare variables in Dbeaver using the "set" statement, such as in the query below:

@set vaolink = 73401;
select distinct 
        creative_id,
        max(partition_date) as max_date
from    meta_ad_xdevice.meta_ad_creative
where   name like '%${vaolink}\\_%'--VAO Link
group by
        creative_id;

This query results 3 values (rows) in the creative_id column. How can I store these 3 rows in one variable? I want the result to be stored in a sigle variable and then use it in other parts of the code.

Can you please help me?

Thank you!

0 Answers
Related