Solved

Not sure how to construct this query

Posted on 2012-03-29
2
291 Views
Last Modified: 2012-03-29
My problem is this: we have a ton of agent commission data in flat files and we are in the process of outsourcing a conversion.  Unfortunately, because we don't have any relational data there is no way for them to piece together commission hierarchies.  So it's up to me to reconstruct them, and I'm a rookie when it comes to Access. There are two tables in my Access database: AGENTS and AGCOMCREV

I need a query to eliminate all the records from AGCOMCREV except for those with the field "AgentCode" matching those found in the field of the same name in AGENTS.  This will reduce my dataset so I can move on to the next step and show you guys what I really need to accomplish.

Thanks for your help!
0
Comment
Question by:kbdaemon
2 Comments
 
LVL 9

Accepted Solution

by:
armchair_scouse earned 500 total points
ID: 37782990
Try

DELETE * FROM AGCOMREV WHERE AgentCode NOT IN (SELECT AgentCode FROM AGENTS)
0
 

Author Closing Comment

by:kbdaemon
ID: 37783466
Works great, but I missed the one character difference in "AgentCode" between the two tables so I just deleted 124,404 rows of data!!! It took too much memory so it was unrecoverable...starting over :(
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
sQL pivot 9 39
MS SQL export CSV & schedule It 9 44
another query question 7 26
Help with SQL Query 23 39
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now