Skip to content
Advertisement

Reusing alias for an expression in postgresql

I am trying to do this:

It is not possible;

column “full_name” does not exist

So, I have to do this:

Does it mean sql engine has to compute expression ‘first_name || ‘ ‘ || last_name’ two times?

Advertisement

Answer

As you observe, what you want to do is not possible. Instead, you can use a lateral join to calculate values in the FROM clause:

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement