I’m attempting to design a delete query calling records from two tables, where if one field from each table matches, then delete all records with that match from one of the tables. I’d appreciate any suggestions or alternate methods.
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Multi-table Delete Query (A2K)
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Multi-table Delete Query (A2K)
- This topic has 14 replies, 4 voices, and was last updated 21 years, 4 months ago.
Viewing 1 reply threadAuthorReplies-
WScharlotte
AskWoody LoungerFebruary 3, 2004 at 1:36 pm #778286Why do you need alternate methods? The only trick to delete queries is that in 2000 and later you must be sure to add the DISTINCTROW keyword, which can be done from the query grid by right clicking on the gray area of the grid and opening the properties dialog for the query. Set Unique Records to Yes, and that will insert DISTINCTROW and make your query updatable.
-
WSimincorrigible
AskWoody LoungerFebruary 11, 2004 at 1:32 pm #782532 -
WSHansV
AskWoody LoungerFebruary 11, 2004 at 1:59 pm #782541We don’t know enough to provide detailed help, but you can probably use a subquery. If you want to delete records from the table that have a match in the union query, the SQL looks like this:
DELETE * FROM tblSomething WHERE UniqueID IN (SELECT UniqueID FROM qryUnion)
You can’t do it the other way round – a union query isn’t updatable.
-
WSimincorrigible
AskWoody LoungerFebruary 11, 2004 at 2:51 pm #782590Hi Hans,
I am trying to update (change not delete) the records in tblwlcostbook. This what the SQL looks like so far:SELECT DISTINCTROW tblCostBook.[Mod], tblCostBook.SN, tblCostBook.LN, qryJoinJNOP.op, tblCostBook.JN, tblCostBook.UCost, tblCostBook.OF, tblCostBook.[D#]
FROM qryJoinJNOP RIGHT JOIN tblCostBook ON qryJoinJNOP.jn = tblCostBook.JN;I am not sure how to change this.
Thank you for your help. John -
WScharlotte
AskWoody Lounger -
WSimincorrigible
AskWoody LoungerFebruary 11, 2004 at 6:03 pm #782735Hi Charlotte-
I am using a union query to bring together the numbers (jn) and the description (op) from a purchased part number table and a labor table. In the select query I am bringing together the Cost Book that has no descriptions, just numbers, and the union query for the description of the number. When I run this select query, I would like to be able to change the information in the fields of the records when we make changes in manufacturing. We might want to change a number because we are using a different part number for a certain model. I also have a field that lets me print the records in a report in a certain order. BY looking at this select query I can tell whether or not the records are in the correct order when I make a change by looking at the description. If they are not in the right order, I would want to be able to change the field contents for any record in the query. Just looking at numbers (jn) are meaningless without the description (op).
If this still doesn’t make sense, please let me know and I will try again.
Thank you for your help. John -
WScharlotte
AskWoody LoungerFebruary 11, 2004 at 7:48 pm #782808 -
WScharlotte
AskWoody LoungerFebruary 11, 2004 at 7:48 pm #782809 -
WSimincorrigible
AskWoody LoungerFebruary 11, 2004 at 6:03 pm #782736Hi Charlotte-
I am using a union query to bring together the numbers (jn) and the description (op) from a purchased part number table and a labor table. In the select query I am bringing together the Cost Book that has no descriptions, just numbers, and the union query for the description of the number. When I run this select query, I would like to be able to change the information in the fields of the records when we make changes in manufacturing. We might want to change a number because we are using a different part number for a certain model. I also have a field that lets me print the records in a report in a certain order. BY looking at this select query I can tell whether or not the records are in the correct order when I make a change by looking at the description. If they are not in the right order, I would want to be able to change the field contents for any record in the query. Just looking at numbers (jn) are meaningless without the description (op).
If this still doesn’t make sense, please let me know and I will try again.
Thank you for your help. John -
WScharlotte
AskWoody Lounger
-
-
WSimincorrigible
AskWoody LoungerFebruary 11, 2004 at 2:51 pm #782591Hi Hans,
I am trying to update (change not delete) the records in tblwlcostbook. This what the SQL looks like so far:SELECT DISTINCTROW tblCostBook.[Mod], tblCostBook.SN, tblCostBook.LN, qryJoinJNOP.op, tblCostBook.JN, tblCostBook.UCost, tblCostBook.OF, tblCostBook.[D#]
FROM qryJoinJNOP RIGHT JOIN tblCostBook ON qryJoinJNOP.jn = tblCostBook.JN;I am not sure how to change this.
Thank you for your help. John
-
-
WSHansV
AskWoody LoungerFebruary 11, 2004 at 1:59 pm #782542We don’t know enough to provide detailed help, but you can probably use a subquery. If you want to delete records from the table that have a match in the union query, the SQL looks like this:
DELETE * FROM tblSomething WHERE UniqueID IN (SELECT UniqueID FROM qryUnion)
You can’t do it the other way round – a union query isn’t updatable.
-
-
WSimincorrigible
AskWoody LoungerFebruary 11, 2004 at 1:32 pm #782534
-
-
WScharlotte
AskWoody LoungerFebruary 3, 2004 at 1:36 pm #778287Why do you need alternate methods? The only trick to delete queries is that in 2000 and later you must be sure to add the DISTINCTROW keyword, which can be done from the query grid by right clicking on the gray area of the grid and opening the properties dialog for the query. Set Unique Records to Yes, and that will insert DISTINCTROW and make your query updatable.
Viewing 1 reply thread -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Disengage Bitlocker
by
CWBillow
1 hour, 13 minutes ago -
Mac Mini M2 Service Program for No Power Issue
by
Alex5723
1 hour, 49 minutes ago -
New Win 11 Pro Geekom Setup questions
by
Deo
3 hours, 33 minutes ago -
Windows 11 Insider Preview build 26200.5651 released to DEV
by
joep517
9 hours, 4 minutes ago -
Windows 11 Insider Preview build 26120.4441 (24H2) released to BETA
by
joep517
9 hours, 6 minutes ago -
iOS 26,, MacOS 26 : Create your own AI chatbot
by
Alex5723
13 hours, 1 minute ago -
New PC transfer program recommendations?
by
DaveBoston
3 hours, 22 minutes ago -
Windows 11 Insider Preview Build 22631.5545 (23H2) released to Release Preview
by
joep517
17 hours, 6 minutes ago -
Windows 10 Build 19045.6029 (22H2) to Release Preview Channel
by
joep517
17 hours, 7 minutes ago -
Best tools for upgrading a Windows 10 to an 11
by
Susan Bradley
5 hours, 26 minutes ago -
The end of Windows 10 is approaching, consider Linux and LibreOffice
by
Alex5723
2 hours, 48 minutes ago -
Extended Windows Built-in Disk Cleanup Utility
by
bbearren
15 hours, 16 minutes ago -
Win 11 24H2 June 2025 Update breaks WIFI
by
dportenlanger
1 day, 12 hours ago -
Update from WinPro 10 v. 1511 on T460p?
by
CatoRenasci
10 hours ago -
System Restore and Updates Paused
by
veteran
1 day, 14 hours ago -
Windows 10/11 clock app
by
Kathy Stevens
1 day, 1 hour ago -
Turn off right-click draw
by
Charles Billow
1 day, 17 hours ago -
Introducing ChromeOS M137 to The Stable Channel
by
Alex5723
1 day, 21 hours ago -
Brian Wilson (The Beach Boys) R.I.P
by
Alex5723
15 hours, 15 minutes ago -
Master patch listing for June 10, 2025
by
Susan Bradley
1 day, 22 hours ago -
Suggestions for New All in One Printer and a Photo Printer Windows 10
by
Win7and10
1 day, 1 hour ago -
Purchasing New Printer. Uninstall old Printer Software First?
by
Win7and10
2 days, 5 hours ago -
KB5060842 Issue (Minor)
by
AC641
17 hours, 5 minutes ago -
EchoLeak : Zero Click M365 Copilot leak sensitive information
by
Alex5723
2 days, 12 hours ago -
24H2 may not be offered June updates
by
Susan Bradley
1 day, 4 hours ago -
Acronis : Tracking Chaos RAT’s evolution (Windows, Linux)
by
Alex5723
3 days ago -
June 2025 updates are out
by
Susan Bradley
6 hours, 5 minutes ago -
Mozilla shutting Deep Fake Detector
by
Alex5723
3 days, 15 hours ago -
Windows-Maintenance-Tool (.bat)
by
Alex5723
3 days ago -
Windows 11 Insider Preview build 26200.5641 released to DEV
by
joep517
3 days, 17 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.