I have a table mytable
and mydate
is a column in it.
However, since the SELECT
clause is dynamic, I need to pre-adjust the column with addMinutes
.
So, the column is added to the variable with the function such that in the event the column turns up in SELECT
the variable is taken over than the actual value in the table.
SELECT mydate FROM "mytable"
original value of
mydate
is returned
WITH addMinutes(mydate,300) AS mydate SELECT mydate FROM "mytable"
original value of
mydate
is returned, expected to return variable value
The exact opposite happens; Even if the variable is mentioned (same name as the column), the actual column value overrides the WITH
clause.
Do we have a workaround to use WITH
clause variables with the same name as the columns in the table?
SELECT
* REPLACE addMinutes(mydate, 300) AS mydate, mytable.mydate
FROM mytable