Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: Recursive Query

Re: Recursive Query

From: Lennart Jonsson <lelle2_at_bonetmail.com>
Date: Wed, 19 Mar 2003 23:28:25 +0100
Message-ID: <b5aqu9$27fc5j$1@ID-167942.news.dfncis.de>


On Wed, 19 Mar 2003 09:58:26 +0000, Ray wrote:

[...]

> select c1.customer_id, c1.customer_name, c1.primary_id,
> --add the primary name recursively
> (select customer_name from customer where customer_id=c1.primary_id)
> primary_name,
> c1.primary_flag, c1.active_flag, c1.last_update_id,
> c1.last_update_date
> from customer c1, customer c2
> group by c1.customer_id
>
> This solution worked for me. I don't know if this is just Sybase
> allowing me to do this or is it ANSI SQL legal. Anyway it works.
>

I dont think your query is illegal, but you should definitely rewrite it. What good does customer c2 (other than exercising your db :-) do? Try removing the group by clause and see what happens, then remove customer c2 and see what happens then.

/Lennart

[...] Received on Wed Mar 19 2003 - 16:28:25 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US