I am migrating from mssql to postgresql
I am trying to assign a value to a temporary variable in select query
Below is the query in mssql
select flag = 0
It gives 0 as output wit flag as column identifier in mssql
I tried the following in postgresql
select flag := 0
select flag [:=0]
It says syntax error at or near :=
Does anybody know where I am going wrong?
Postgres honors the SQL standard and a column alias is defined with the AS keyword there.
So to get a column named
flag
with the value zero use the following:flag = 0
in standard SQL (and Postgres) is a boolean expression that compares the the columnflag
with the value zero and returns either true, false or null depending on the column's value.