Solved

Need to select for missing referencial integrity

Posted on 2010-09-14
1
321 Views
Last Modified: 2012-05-10
I've noticed some records where I have zero for the id of a foreign key.

I'd like a query which will tell me which records don't reference my main table.

My main table is called Pads, the primary key is PadID, the field with zero entries is AuthorID
My Other table is Authors and the primary key is AuthorID.

So I want a list of Author Records where the AuthorID doesn't appear in the pads table.
0
Comment
Question by:mindwarpltd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 31

Accepted Solution

by:
RiteshShah earned 500 total points
ID: 33671465
select * from Authors where AuthorID not in (Select distinct AuthorID from Pads)
0

Featured Post

Technology Partners: 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

Suggested Solutions

Title # Comments Views Activity
error doing substr 3 36
removing unwanted rows from an sql server ranked table 13 35
Access control a form field in Lotus Notes 3 24
Database Owner 3 16
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. This article shows how to create one of these functions to write directly to Azure Table Storage.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

756 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