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 > Data Access, Manipulation & Batch Languages > ANSI SQL > unequal fields in one and two tables (was "simple query: but i cant seem to get it")

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-26-05, 05:11
newimmigrant newimmigrant is offline
Registered User
 
Join Date: Feb 2005
Posts: 8
unequal fields in one and two tables (was "simple query: but i cant seem to get it")

i have a table t1 with 2 fields f1,f2

i want to find out all the fields where f1 <> f2.

similarly i have 2 tables t1(field f1) and t2 (field z1)

i want to find out all the entries where f1 not in t2 and all entries where z1 not in t1.
Reply With Quote
  #2 (permalink)  
Old 02-26-05, 05:12
newimmigrant newimmigrant is offline
Registered User
 
Join Date: Feb 2005
Posts: 8
the message was posted incomplete

Hello, the previous message was posted incomplete.

I wanted to also ask, if it is possible to do it in a single query?

thank you very much for your help.
Reply With Quote
  #3 (permalink)  
Old 02-26-05, 05:45
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
i hope you don't mind my saying so, but this sounds like homework

i'll only do the first of these for you

all the fields where f1 <> f2 --
Code:
select f1, f2 from t1 where f1 <> f2


are you sure you want the above query combined with the second query?

may i ask you, what have you tried for the second query?

do you have any SQL books nearby?

please look up NOT EXISTS and let me know what it says

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my 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