maximus
maximus

Reputation: 11514

How to sql-recursive statements work?

I am trying to understand sql recursive statements, but it is really hard for me. For example:

enter image description here

Thats an exampe I am trying to understand and to write down the output.

Can sb pls explain me how this works, step by step?

greetings and thx in advance

maya

Upvotes: 5

Views: 1508

Answers (2)

Chris Travers
Chris Travers

Reputation: 26464

The UNION ALL portion gets recursed until it returns no more records. I don't know if you can have multiple UNION ALL portions.

Upvotes: 0

devdigital
devdigital

Reputation: 34349

Also, see here - http://www.postgresql.org/docs/8.4/static/queries-with.html, where the steps of the recursive query evaluation are described.

Upvotes: 2

Related Questions