If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > How to issue this logic in query?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-12-04, 18:38
oldersea oldersea is offline
Registered User
 
Join Date: Apr 2004
Posts: 10
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!
Reply With Quote
  #2 (permalink)  
Old 04-14-04, 02:13
kadapa22 kadapa22 is offline
Registered User
 
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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On