Skip to content
Advertisement

Postgresql reference a variable within statement

I come across this scenario frequently in sql and I have seen it done, but would like to summarize the case when/when not to reference a new variable within a statement.

  1. This doesn’t work –
  1. but this does –

How can I implement scenario 1?

Advertisement

Answer

You can use a subquery.

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