Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2002
    Posts
    11

    Question Unanswered: Comparing columns contents between 2 table...

    any idea on the syntax for such a querie? all my attempts to compare an item # column in 2 seperate tables keep coming up an incorrect syntax...(I want to compare one column in one table with a column in another table).

    Thanks in advance

  2. #2
    Join Date
    Dec 2001
    Location
    Toronto, Canada
    Posts
    335
    I'm not sure on what you are asking?

    SELECT a.*
    FROM TBL a, TBL b
    WHERE a.col = b.col

    or

    SELECT a.*
    FROM TBL a
    WHERE NOT EXISTS
    (
    SELECT *
    FROM TBL b
    WHERE a.col = b.col
    )

    ????

  3. #3
    Join Date
    Feb 2002
    Posts
    11
    sorry I did not respond to your reply:

    Thanks for the info - also the first one works for me...


    SELECT *
    FROM tableA, tableB
    WHERE tableA.a_fieldname = tableB.b_fieldname


    simple really

    Again thanks... Now if I can only get it to ignore NULL and empty cells...

  4. #4
    Join Date
    Mar 2002
    Location
    Edinburgh
    Posts
    8
    SELECT *
    FROM tableA, tableB
    WHERE tableA.a_fieldname = tableB.b_fieldname
    AND tableB.b_fieldname is not null
    and LEN (tableB.b_fieldname) <> 0


    --you can also put in tableA.a_fieldname as well if you so desire
    -- tell me if that sorts out your problem

  5. #5
    Join Date
    Feb 2002
    Posts
    11
    thanks works fine

    got to get it onto my production server and run now... Thanks,

Posting Permissions

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