czchlong
czchlong

Reputation: 2584

Do not understand why the following query is wrong

I am using Sybase and it complains the following has a syntax error:

DELETE
  *
FROM
  table1 INNER JOIN table2 ON table1.some_col = table2.some_col

The specific error is: Incorrect syntax near the keyword 'inner join'.

I've checked online and this is how people go about it, but mine refuses to accept this.

Could someone please tell me what is wrong?

Upvotes: 1

Views: 130

Answers (2)

Adriano Carneiro
Adriano Carneiro

Reputation: 58595

According to Sybase's Manual, it should be like this:

DELETE
FROM table1
FROM table1, table2
WHERE 
  table1.some_col = table2.some_col

Upvotes: 1

iruvar
iruvar

Reputation: 23364

assuming you intend to delete from table1 based on a join with table2 the following

DELETE table1
FROM
table1 INNER JOIN table2 ON table1.some_col = table2.some_col

Upvotes: 2

Related Questions