0
DELETE FROM Table1
INNER JOIN View1 ON Table1.ID = View1.ID
WHERE Table1.ID = View1.ID;

error is SQL command not ended properly

meltonCG
  • 119
  • 1
  • 11
  • possible duplicate of [How Delete using INNER JOIN with SQL Server?](http://stackoverflow.com/questions/16481379/how-delete-using-inner-join-with-sql-server) – Jon Egerton Dec 16 '13 at 11:03

3 Answers3

1

Specify the table where you want to delete the records,

DELETE Table1                        -- <== this will delete records from Table1
FROM   Table1
       INNER JOIN Table2 ON Table1.ID = Table2.ID
WHERE Table1.ID = Table2.ID;
John Woo
  • 249,283
  • 65
  • 481
  • 481
1
DELETE Table1
FROM   Table1
INNER JOIN View1
ON Table1.ID = View1.ID;
Sampat Badhe
  • 8,042
  • 6
  • 31
  • 48
1

How you do this depends on the dialect of SQL. Here is a method that should work in any database:

DELETE FROM Table1
WHERE Table1.Id in (select Id from View1);
Gordon Linoff
  • 1,198,228
  • 53
  • 572
  • 709