Lars Ljungberg
Lars Ljungberg

Reputation: 313

using WITH clause for PostgreSQL?

I was planning to use the WITH clause with PostgreSQL, but it doesn't seem to support the command. Is there a substitute command?

What I want to do is with one query select several sub-resultsets and use parts of the sub-resultsets to create my final SELECT.

That would have been easy using the WITH clause.

UPDATE:

Opps! I discovered that I misunderstood the error message I got; and pgSQL does support WITH.

Upvotes: 0

Views: 1214

Answers (1)

Craig Ringer
Craig Ringer

Reputation: 324375

PostgreSQL supports common-table expressions (WITH queries) in version 8.4 and above. See common table expressions in the manual.

You should really include your PostgreSQL version, the exact text of the error message, and the exact text of any query you ran in your question. Where practical/relevant also include table definitions, sample data, and expected results.

Upvotes: 1

Related Questions