Equivalent of Recursive queries

Moderator: NorbertKrupa

Post Reply
User avatar
nnani
Master
Master
Posts: 302
Joined: Fri Apr 13, 2012 6:28 am
Contact:

Equivalent of Recursive queries

Post by nnani » Fri May 31, 2013 9:31 am

Hello All

In TD the recursive queries are supported with the WITH clause,
The table in the WITH clause can be referenced in the select queries after it.
Do we have a feature like this in Vertica.

I have checked that Vertica provides WITH clause but it has restrictions with the recursive queries inside it.

Code: Select all

create local temporary table tmp_litab on commit preserve rows as(
WITH tmp_with_table as (select pm_id, pm_name from tempdb.kptab

UNION ALL

select pm_id,pm_name,t.pm_id, t.pm_name
from
(WITH
tmp_withs_table as (select pm_id, pm_name from tempdb.kptab)), tempdb.kptab)
select * from tmp_with_table);
The code does not work. Any other way we can acheive this.......
nnani........
Long way to go

You can check out my blogs at vertica-howto

Post Reply

Return to “Vertica Database Development”