Delete records from one table when entered in to another in base

I’m pretty new to SQL in base, I’ve got a few queries set up now with a little help (thanks JohnSUN) which is great. I’m now exploring and have successfully used the DELETE FROM command for removing multiple entries from a table but would like to go a little further.

Rather than individually deleting rows by using…
DELETE FROM “table”
WHERE “Column” = ‘1234’
I’d rather delete entries from the first table by matching entries from a column in a second table. I’ve had a good go but don’t yet have a good enough grasp of sql to figure it out for myself.

Hopefully thats clear and thanks in advance to anyone who can help

If JohnSUN’s answer helped then please click the checkmark on that answer. Otherwise, why should anyone spend time on this new question?

I think what Jim K is trying to say, is that a thank you goes a long way here, as all questions are answered by volunteers. The best way to thank someone here is to up-vote their answer. There are two ways to do this, first you can click on the check box in the circle to say that this answer is the, or the best, answer for you. Also you can check the up arrow (in the vertical ^ # v set to the left of the answer’s title.

I missed that checkmark and have corrected it accordingly

Hello,

You don’t provide much information on what conditions you are trying to satisfy 'by matching entries from a column in a second table. ’ There are many examples around which may help

how-to-delete-records-in-one-table-based-on-the-values-in-another-table

similar concept

Just a small sample of what is already available with a simple search.

Also, you do not state what database you are using. This can make a difference in the SQL used.

I agree its not a particularly well written question having looked back at it (probably not best off writing it whilst tired). I’ll look over what you’ve posted tomorrow. Thanks for taking the time to point me somewhere at least though.

If you still have a problem after viewing links, please post additional info - DB used & exactly what determines if a record is to be deleted would be of great help.

Still struggling, I have next to no experience with this kind of thing so please bear with me.
I have two tables that both have a column called Tag.
The first by necessity can have multiple records with the same tag number whilst the second allows no duplicates.
Once a series of tag numbers is entered in to the second table, I’d like to be able to run an sql command to remove all rows with matching tag numbers from table one as they are no longer required there.
Hopefully thats clearer

When it comes to deleting records you really need to be certain of what is to be deleted. Are you stating that if a tag exists in table “B”, all records in table “A” containing that tag should be deleted? If so:

DELETE FROM TABLEA WHERE TAG IN (SELECT TAG FROM TABLEB)

should work. Like any other test, make a backup copy first to insure this is actually the result wanted.

DELETE FROM TABLEA WHERE TAG IN (SELECT TAG FROM TABLEB)

Thats exactly what I was after so I’ve marked the question as answered Many thanks.