[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Need to select for missing referencial integrity

Posted on 2010-09-14
1
Medium Priority
?
326 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
1 Comment
 
LVL 31

Accepted Solution

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

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

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

What we learned in Webroot's webinar on multi-vector protection.
Blockchain technology enhances society similar to the Internet. Its effects are broad, disruptive, and will boost global productivity.
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…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

607 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