Microsoft
Software
Hardware
Network
Question : Select Missing Rows From Table (Determination Made Based on Multiple Columns)
Greetings, I need some expert help. I have two tables and I need to find rows in table #1 that are missing in table #2. To determine what is "Missing" I need to search multiple columns. Here is an Example of my table structure:
Table_1
--------------------
Table_1_Unique_ID (int)
PIN (varchar(6))
AIN (varchar(9))
TypeID (int)
Table_2
--------------------
Table_2_Unique_ID (int)
PIN (varchar(6))
AIN (varchar(9))
TypeID (int)
Since Table_2 doesn't have Table_1_Unique_ID as a foreign key, I guess I need to make the mix of PIN/AIN/TypeID act like the key in order to find rows that are missing from Table_2... I just don't know how to do that.
Thank you in advance for your help!
Answer : Select Missing Rows From Table (Determination Made Based on Multiple Columns)
This should help:
select t1.*
FROM Table_1 t1 LEFT OUTER JOIN Table_2 t2
ON t1.PIN = t2.PIN
AND t1.AIN = t2.AIN
AND t1.TypeID = t2.TypeID
WHERE t2.Table_2_Unique_ID is NULL
Random Solutions
Home folder quotas - best method?
Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI<wbr />_AS" and "Latin1_General_CI_AS" in the equal to operation
How do I compact a MSDE Database?
how to count the number of browser tabs are opened for an application?
logon.exe deleted - need help restoring it
Jump from main form into sun forms code in lost focus
How do I add users to SharePoint 2.0 site via Address Book in Office 2007?
Exchange 2007 mail redirect to external address?
Authentication for OWA in Exchange 2007 fails.
There is a(n) " in the form control's validationrule property