Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004
    Posts
    10

    Unanswered: How to issue this logic in query?

    Hi,

    I wrote a script in qurey a list from two related (PK--FK) tables.
    I wanted to qurey two catelogues:
    1.Exist in one table as PK but not exist in the other table;
    2.Exist in one table as PK and also in the other tabls as FK;
    Both 1 & 2 have to satisfy condition A&B;

    There exist this logical "OR" to pursue the qurey.eg.

    where
    conditionA
    and conditionB
    and SSN not in
    (selct...)

    or SSN in
    (Select...)

    I wonder by doing this am I right in the logics? Is there any better solutions?

    thanks a lot!

  2. #2
    Join Date
    Mar 2004
    Location
    india
    Posts
    24

    use outer join

    Use OUTER JOIN , which will give the records which are in both the tables and which are in table 1 and not in table 2. syntax you can check in any book.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •