2 add tags
source | link

Suppose that I have a query Q1 and I need to run a query like the following:

Q1
union
select *
from (some query that uses Q1 outcome)

I would like to do that:

  • Without creating any view
  • Without running twice the Q1 query.

How can I do that on PostgresqlPostgreSQL?

Suppose that I have a query Q1 and I need to run a query like the following:

Q1
union
select *
from (some query that uses Q1 outcome)

I would like to do that:

  • Without creating any view
  • Without running twice the Q1 query.

How can I do that on Postgresql?

Suppose that I have a query Q1 and I need to run a query like the following:

Q1
union
select *
from (some query that uses Q1 outcome)

I would like to do that:

  • Without creating any view
  • Without running twice the Q1 query.

How can I do that on PostgreSQL?

1
source | link

Avoiding repetition without creating a view

Suppose that I have a query Q1 and I need to run a query like the following:

Q1
union
select *
from (some query that uses Q1 outcome)

I would like to do that:

  • Without creating any view
  • Without running twice the Q1 query.

How can I do that on Postgresql?