8

Oh for fuck's sake.

delete from FooTable where FooID in (select FooID from OtherTable)

If there is no field called FooID in OtherTable, then the bracketed select is just the FooID of the current record in FooTable, repeated n times where there are n rows in OtherTable. So it matches every record.

Which makes perfect sense, but for fuck's sake.

Obviously if this was prod I would have been using fully-qualified column names.

But nevertheless, for fuck's sake.

Comments
  • 1
    Never do a delete without rollback, unless you enjoy explaining to your boss why an angry client is complaining that their data has mysteriously vanished.
    Thus, soft delete because: oops... nevermind.
Add Comment