Skip to content
Advertisement

Postgres : using computed variable in a SELECT statement part 1/2

I’m having a SELECT statement as follow (doesn’t work):

Is there a way to “inject” here the “variable” age_normin the query ?

EDIT:

Asked a similar question here, but this time with an additional column in the SELECT statement, which is the use case I’m trying to solve

Advertisement

Answer

We can calculate the age_norm column in a subquery and then use age_norm by CASE WHEN in the main query.

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