Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2005
    Posts
    8

    Unanswered: 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.

  2. #2
    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.

  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    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

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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