Hi, how can I declare datetime variable and then use it in a query?
For example:
Solved! Go to Solution.
Hi,
The SQL Report Builder doesn't support variable declaration syntax like your example - try a WITH clause at the beginning. You can use this to effectively create a temporary table, which you can then select your variable from.
For example:
with tmp as (select '2020-08-20'::DATE as mydate ) select "entity_id", "created_at" from "sales_order" where "created_at" >= (select mydate from tmp) limit 10;
any answer?
Hi,
The SQL Report Builder doesn't support variable declaration syntax like your example - try a WITH clause at the beginning. You can use this to effectively create a temporary table, which you can then select your variable from.
For example:
with tmp as (select '2020-08-20'::DATE as mydate ) select "entity_id", "created_at" from "sales_order" where "created_at" >= (select mydate from tmp) limit 10;