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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compare Query?~

Status
Not open for further replies.

Wiz0fBaud

Technical User
Jul 2, 2003
45
0
0
US
Hey guys, really simple, I think, but I'm a tech, not a programmer.

I have two queries that spit out a list. Basically there are two queries are electrical Inputs/Outputs. The InputID of one query matches the OutputID of the second query. We have a problem though, there are like over 2 thousand signals, and there are more electrical inputs than outputs. How do I write a query that compares those IDs and says hey, I found the culprit inputs that aren't in the output table, and here's a list?

Anyone follow?
 
I think that this should give you a list of the culprits:

SELECT InputTable.InputID
FROM InputTable LEFT JOIN OutputTable ON InputTable.InputID = OutputTable.OutputID
WHERE (((OutputTable.OutputID) Is Null));


-Gary
 
how about if I only want to compare say the first 10 characters in that field? any ideas?
 
That is kind of vague. Do you mean you want to compare if the 1st 10 characters are in the field or not or do you mean you want to do a comparison to determine if the record is in the table?
 
The thing is the InputID, has IID added on, and the Output has OID added on. So For example, I have a signal say marked by ABCD, well the Input Id is ABCDIID and the output is ABCDOID. How would I tell this compare query to only find the ABC instead of the entire field?
 
I see. Try this:

SELECT InputTable.InputID
FROM InputTable LEFT JOIN OutputTable ON left(InputTable.InputID,10) = left(OutputTable.OutputID,10)
WHERE (((OutputTable.OutputID) Is Null));
 
Ultimately, you will probably be better served by splitting this field into two fields in your base table.

-Gary
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top