1

I have table like this

table1
column1 column2 column3
-----------------------
11      12      13
21      22      23
31      32      33

and a View like this

view1
column1 column2 column3
-----------------------
11      12      13
31      32      33

How to delete rows from table1 that have a match in view1?

suriel
  • 191
  • 1
  • 10
  • https://stackoverflow.com/q/5585732/2864740 - perhaps with a WHERE .. EXISTS filter to a subquery. A phrase for this ask is a "delete with join", and it doesn't appear MS Access supports such syntax. – user2864740 Dec 07 '21 at 06:28
  • Or maybe it does .. https://stackoverflow.com/a/889643/2864740 - perhaps relates to MS Access version? – user2864740 Dec 07 '21 at 06:32
  • Does this answer your question? [MS-Access: Selecting rows to delete via joins](https://stackoverflow.com/questions/889517/ms-access-selecting-rows-to-delete-via-joins) – June7 Dec 07 '21 at 06:35

1 Answers1

1

Try the below sql query:

DELETE Table_1
FROM    Table_1  INNER JOIN  View1 
ON Table_1.col1 = View1.col1  
WHERE   Table_1.col1=View1.col1  

First join the table and view using INNER JOIN, then based on the condition delete the row.

buddemat
  • 4,552
  • 14
  • 29
  • 49
Sathiya
  • 250
  • 2
  • 2