Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: ???? SQL question ????
A classical design issue,
If the relationship remains the same, the same logic should apply. Prior to the new situation the relationship (T1 -> T2) was 1 -> many (optional). If it's changed, can you describe it?
On Tue, 13 Jan 1998 13:37:38 +0100, ilepper_at_fac.fbk.eur.nl (ilepper) wrote:
>Ok here's a nice SQL problem, who can solve this one?
>
>I have got 2 tables
>
>Table 1 :
>prim. key : Id1, Id2, Id3
>
>Table 2 :
>prim. key : Id
>for. key : Table1_id1, Table1_id2, Table1_id3
>
>I want to do the following : I would like all records from table 1 where
>there's no record for it in table 2.
>
>Usualy it would look something like this :
>select * from table 1 where id not in (select id from table 2)
In terms of resources, this query is not efficient. You should use either an 'exists' or an 'outer join' where Table2.ld is null.
>but now table one has more attributes forming the prim. key.
>
>How can it be done, anyone?
>
>Thanks anyway for trying,
>by the way, I am using Orcale version 7, and Delphi 3 to excute the SQL
>query.
>
>Ido de Lepper
>ilepper_at_fac.fbk.eur.nl
Kaboel Karso
Consultant
\\\|/// \\ ~ ~ // ( @ @ ) ==========================-oOOo-(_)-oOOo-=================== eSCOSYS Consultancy Phone : +31 (0)32 024 7285 Horst 2827 Fax : +31 (0)32 024 7286 8225 MZ Lelystad Mobile : +31 (0)65 498 5413 The Netherlands email : kkarso_at_knoware.nl ==================================-Oooo.-=================== .oooO ( ) ( ) ) / \ ( (_/Received on Tue Jan 13 1998 - 00:00:00 CST