user3299633
user3299633

Reputation: 3390

LIMIT clause on DELETE Query with Sub Query

I am getting a syntax error when trying to run this query:

delete a from db.tablea a where a.id in (select id from db2.ids) limit 10000;

Can someone advise a way to rework this query and provide this same logic?

Upvotes: 0

Views: 168

Answers (1)

ysth
ysth

Reputation: 98528

You are using the multi-table syntax, which allows joins (and deleting from any of the joined tables) but not limit. Use the single table syntax instead:

delete from db.tablea where id in (select id from db2.ids) limit 10000;

Upvotes: 1

Related Questions