delete query with correlated subquery throwing error

286 views Asked by At

DELETE FROM cats c WHERE EXISTS (SELECT 1 FROM owner_cats o WHERE o.id_cat = c.id_cat AND o.id_owner = 1)

Tables names are different. This is throwing sybase errror 107. The column prefix '%.*s' does not match with a table name or alias name used in the query. Either the table is not specified in the FROM clause or it has a correlation name which must be used instead. Explanation.

Everything seems to b e correct with query. Please help.

1

There are 1 answers

1
RobV On

You gotta change it to DELETE cats FROM cats c (etc).