×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

query probably using NOT EXIST

query probably using NOT EXIST

query probably using NOT EXIST

(OP)
I have a table that is my main table(titled Working). In addition to other fields I have a field titled AutomationID and another titled DealerID. I download this main table on a monthly basis. There are many records that do not have a DealerID.

I have a secondary table that I want to use to handle data I receive on a monthly bases that has no DealerID. When I get a record with no DealerID I need to manually insert the dealer ID in the main table. I want to use this secondary table to store records with both a AutomatinID and a DealerID. I can then use this table to update the main table and eliminate the excessive manual process.

I need a query that will look at the main table and select the records without a DealerID that is not already in the secondary table. I will then update the main table with the DealerID from the secondary table using the AutomationID to match the DealerID. My monthly data import always has the AutomationID.

I assume I need to use NOT EXIST in my query but I can’t seem to figure out how to do this properly.

Any assistance is appreciated.

Ron--

RE: query probably using NOT EXIST

"I have a secondary table [...] that has no DealerID" and then "I want to use this secondary table to store records with both a AutomatinID and a DealerID"
But your 'secondary table' does not have a field DealerID... ponder

Is there a relation between AutomatinID and a DealerID ?


---- Andy

There is a great need for a sarcasm font.

RE: query probably using NOT EXIST

(OP)
I want the secondary table to initially show me the records without DealerID's. We will add the correct DealerID and then use this table to update the main table with the correct DealerID. The AutomationID is actually the account number for the dealer account. All records have the AutomationID.

When I run the query I need to get only the AutomationID's that don't have an associated DealerID, thus the "NOT Exist" part.

Ron--

RE: query probably using NOT EXIST

SELECT AutomationID
FROM Working
WHERE DealerID IS NULL


Maybe...?

It would be a lot easier to help you if you would show some sample data and the outcome you expect, something like:

Working table
AutomationID  DealerID
12              54
13
14              67
15
16              88

secondary table 
AutomationID
10
11
12
13
 

And the outcome would be:
???

---- Andy

There is a great need for a sarcasm font.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close