[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Find non matching records

Posted on 2007-10-12
6
Medium Priority
?
189 Views
Last Modified: 2010-03-20
Hi,
Can someone tell me how I would find all records that do not have an ID match. Currently, I have a query which outputs all records where ID'sfrom two tables match. I would like to modify this to have where the ID's do not match?

Cheers
0
Comment
Question by:andyb7901
  • 3
  • 3
6 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 20064083
Replace '=' with  '<>'  in your query
0
 

Author Comment

by:andyb7901
ID: 20064128
So would It be a where clause? If I run the following query without the Where clause I return 1144, out of my original 1452. So by changing my query I should return around 300 records. Can someone help with the syntax?

SELECT tbl_CasRecords.spn_id, tbl_kyc_status.kyc_status_name, tbl_CasRecords.Field3, tbl_CasRecords.Field4, tbl_CasRecords.Field5, tbl_CasRecords.Field6, tbl_CasRecords.Field7, tbl_CasRecords.Field8, tbl_CasRecords.Field10, tbl_CasRecords.Field11, tbl_CasRecords.Field12, tbl_CasRecords.Field13, tbl_CasRecords.Field14, tbl_CasRecords.Field15, tbl_CasRecords.Field16
FROM tbl_kyc_status INNER JOIN (tbl_CasRecords INNER JOIN tbl_adequacy_list ON tbl_CasRecords.spn_id = tbl_adequacy_list.spn_id) ON tbl_kyc_status.status_id = tbl_adequacy_list.kyc_statis_id
WHERE tbl_CasRecords.spn_id <> tbl_adequacy_list.spn_id;
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 20064318
can you give me some sample values and  the results you are looking for (4-5 values will do )
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:andyb7901
ID: 20064363
Its quite sensitive material so cant really post it. But all I really need to know is which spn_id numbers do not match between the two tables. Output just the SPN numbers that do not match (Dont worry about the other fields, just spn number)

Sorry for being vague?

SELECT tbl_CasRecords.spn_id
FROM tbl_kyc_status
INNER JOIN tbl_adequacy_list ON tbl_CasRecords.spn_id = tbl_adequacy_list.spn_id
WHERE tbl_CasRecords.spn_id <> tbl_adequacy_list.spn_id;
0
 

Author Comment

by:andyb7901
ID: 20064366
Sorry that should be from FROM tbl_CasRecords
0
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 2000 total points
ID: 20064405
SELECT t.ords.spn_id
FROM tbl_CasRecords t
WHERE NOT EXISTS (SELECT 1 FROM tbl_adequacy_list  where spn_id = t.spn_id )
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question