Re: SQL QUESTION (ADVANCED ??)
Date: Thu, 8 Sep 1994 15:14:28 GMT
Message-ID: <oliver.779037268_at_sun>
jos_at_zeus.wnc.nedlloyd.nl (Jos Kerssens) writes:
>So far I got a number of answers to my question but,
>unfortunately, I still didn'y get the one I need.
>Thanks a lot for the effort anyway.
>Let me explain why the answers so far don't suffice.
>Suppose I have a case like this:
> table A table B table C
> acol acol ccol ccol
> A1 A1 - C1 C1
> A2 A2 - C1 C2
> A3 A2 - C2 C3
> A4 A3 - C2 C4
> A5 A3 - C3 C5
> A4 - C3
> A4 - C4
> A5 - C4
> A5 - C5
>L. Scott Johnson's select statement would only give me:
>A1
>A2
>Hank Robinson's first statement would give:
>A1
>A2
>His second statement would give:
>A1
>A2
>The statement of Larry Kramer would give:
>A1
>A2
>And I really need:
>A1
>A2
>A3
>A4
>A5
>since they're all connected through the values of ccol.
>The table has (apart from the values above) also values that are not connected
>at all to A1 (f.i. A99 - C99 without any other record having A99 or C99).
>That's why I call A1 to A5 a 'group'.
>Making more subselects or joins as in the above statements wouldn't help,
>since I don't know how many I need.
>So, I guess we're still searching for the answer...
>Regards,
>Jos.
>P.S. It's not a matter of efficiency, I just need the data...
Hi Jos,
I'm terribly sorry but I guess SQL is not powerfull enough to solve your problem, because it can not handle recursive queries. As you stated you can't say that there are only n items connected, which could be handled by a query with n subqueries, so you need something like an iteration or recursion, and SQL unfortunately doesn't offer that.
I fear this is not much help for you.
Bye
Oliver
-- ------------------------------------------------------------------------ Oliver Kuhn email: Steigertsweg 5 oli_at_rgb.informatik.th-darmstadt.de 64297 Darmstadt oliver_at_subito.deReceived on Thu Sep 08 1994 - 17:14:28 CEST