SQL question

From: Michael Hanke <mike_at_hit.handshake.de>
Date: 1996/07/20
Message-ID: <6DCyYJnJNtB_at_hit-mike.hit.handshake.de>#1/1


Hi,

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. In the following example would ID_A = 512 returned for ID_B = 1. ID_B = 25 doesn't match because no set in A contains *all* the attributes of set 25 in B. To solve this query with a single SQL statement would by nice, but probably I have to code it in PL/SQL.

TAB_A                                     TAB_B
===============                           ===============
ID_A     ATTR_A                           ID_B     ATTR_B
---------------                           ---------------
512      1                                  1      1
512      4                                  1      4
512      5                                  1      5
512     17                                 13      1
539      2                                  .      .
.       .                                  25      1
568      5                                 25      5
568      7                                 25     12
568     12                                 43      5
.       .                                   .      .
.       .

Perhaps you can give me some hints to code this stuff as nice as possible ;-)

Michael

                             ._____|_____.
                                 \(*)/
                                 o/ \o                        EDDR
------------------------------------------------------------------
Michael Hanke     MIKE_at_HIT.handshake.de * CompuServe: 100042,2367
              --->      PGP on demand.     <---
Received on Sat Jul 20 1996 - 00:00:00 CEST

Original text of this message