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
  • 258,903
  • 69
  • 498
  • 492
1
DELETE Table1
FROM   Table1
INNER JOIN View1
ON Table1.ID = View1.ID;
Sampat Badhe
  • 8,710
  • 7
  • 33
  • 49
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,242,037
  • 58
  • 646
  • 786