Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get uncomman info between 2 tables

Status
Not open for further replies.

sonikudi

Technical User
Sep 9, 2007
81
0
0
US
Hey all,

This query has me..pulling my hair away. I want this query below to give me results from [PCB Incoming_Production Results] table where the error code in PCB Incoming_Production Results] are not in the [PCB Error Codes] table. but this gives me all possible combinations as my where clause.

The PCB Error codes table has only 2 columns the code and description of the code and the only thing could be common between both the tables is the error code. however there are error codes in the PCB Incoming_Production Results column not in [PCB Error Codes]

Code:
StrSQL = "SELECT t1.[Error Code],t2.Description,COUNT(t1.[PCB SS #]) AS TtlNumberFailed " & _
" FROM [PCB Incoming_Production Results] AS t1, [PCB Error Codes] as t2 " & _
" WHERE t1.[Error Code]<> 'Pass' AND t1.[Error Code]<> t2.[Code] AND Manufacturer = """ & Me.txtMfg & """ And [Date] Between #" & _
   Me.txtMfgStart & "# AND #" & Me.txtMfgEnd & "# GROUP BY t1.[Error Code],t2.Description; "

thanks for any help.
 
Have you looked at the "Find Unmatched Query Wizard"? This should be listed when you click New to create a new query.
 
The wizard doesn't work ..because the tables aren't related to each other
 
hey thanks fneily. It worked after i specified the one-to-many relationship between the tables.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top