All for Joomla All for Webmasters


This is very commonly asked question that how to delete or update rows using join clause

It is not a very easy process, sometimes, we need to update or delete records on the basis of complex WHERE clauses.

There are three tables which we use to operate on SQL syntax for DELETE JOIN.

These tables are table1, table2 and target table.

SQL Syntax for delete JOIN

  1. DELETE [target table]
  2. FROM    [table1]
  3.         INNER JOIN [table2]
  4. ON [table1.[joining column] = [table2].[joining column]
  5. WHERE   [condition]

Syntax for update

  1. UPDATE [target table]
  2. SET [target column] = [new value]
  3. FROM    [table1]
  4.         INNER JOIN [table2]
  5. ON [table1.[joining column] = [table2].[joining column]
  6. WHERE   [condition]
submit to reddit

Leave a Reply