• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 223
  • Last Modified:

Need Help Comparing Data from Two SQL tables

I have two tables in a database and I'm trying to find items in one table that does not have a match in another table... All of the fields don't match, but just a couple.  Here's what I tried and it does return some records, however, as I spot check, it's returning records that do have a match.

select *  
from IronData B
where not exists (select * from ndxdata A where A.custbox <>''
      and A.custbox in (B.custboxnbr, B.SKPboxnbr));

I'm looking for any record from table B which fields 'custboxnbr' or 'skpboxnbr' do not match a record from table A's 'custbox' field
1 Solution
select * from IronData
where custboxnbr not in (select custboxnbr from ndxdata where....)
or skpboxnbr not in (select skpboxnbr from ndxdate where....)
RavenTimAuthor Commented:
Sorry,  This was a duplicate post.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now