Re: SQL question

From: Jean-Marc Arzoumanian <jmarzou_at_worlnet.fr>
Date: 1996/07/21
Message-ID: <31F232EC.39A7_at_worlnet.fr>#1/1


Michael Hanke wrote:
> ...
> I wonder if there is a way to solve the following problem by using a SQL
> query:
>
> There are two tables (TAB_A, TAB_B) containing ID numbers and attributes.
> I want to select those ID_As in table A where all attributes of a given
> ID_B in table B are contained in the set of A
> ...

Hi Michael,

I think I found a solution that might solve your problem. Try the following query:

	select
		id_a
	from 
		tab_a,
		tab_b x
	where
		attr_a = attr_b and
		id_b = << your id >>
	group by
		id_a,
		id_b
	having
		count(*) = (select count(*) from tab_b y where y.id_b = x.id_b);

As you can read it, PL/SQL is not always the best way ! Bye from Paris.

Jean-Marc
(jmarzou_at_worldnet.fr) Received on Sun Jul 21 1996 - 00:00:00 CEST

Original text of this message