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?
CodePudding user response:
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.