Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Comparing Table data oddities

Comparing Table data oddities

Comparing Table data oddities


I have two tables. I want to pull the MstrTab.ISBN, MstrTab.Title from MstrTab that dont exist in HPtab.ISBN.

MstrTab (419 rows) and HPtab (193 rows)

I've tried this statement:

SELECT mstrtab.ISBN, mstrtab.title
FROM mstrtab
WHERE mstrtab.ISBN NOT IN (SELECT HPtab.ISBN from HPtab )

It's returning 239 rows.

419 - 193 = 226 rows.

BTW mstrtab.ISBN = HPtab.ISBN

Question: Is this a good statement I'm using or is there a more accurate way?

I've tried and except clause

select ISBN from mstrtab
select ISBN from HPtab

and it's returning 238 rows. (I did find one duplicate ISBN in the mstrtab table)

Any Ideas ?



RE: Comparing Table data oddities

I'd say: if it gives you accurate results, then it is good.

I also use something like:
select ISBN from mstrtab
select ISBN from HPtab

and the other way around
select ISBN from HPtab
select ISBN from mstrtab

especially when I want to compare more than one field:
Select FieldA, FieldB, FieldC From TableA
Select FieldX, FieldY, FieldZ From TableX

Have fun.

---- Andy

There is a great need for a sarcasm font.

RE: Comparing Table data oddities

Both the approaches you show should work, so this is likely an issue with your data.


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close