in reply to Re^3: cleaning up dbi code
in thread cleaning up dbi code

why does it delete the whole table? I ran it earlier and it didn't delete the whole table? doesn't it just delete the rows that satisfy the join?

Replies are listed 'Best First'.
Re^5: cleaning up dbi code
by Corion (Patriarch) on Nov 26, 2010 at 19:55 UTC
    delete b.* from tbl a inner join tbl b on a.col1 = b.col1

    This looks like a self-join of the table with itself to me. But if your posted SQL was just sample code, maybe you should work more on workable samples you post. If not, consider thinking more about what you really want to do.

    One standard practice I have when using rm or delete is to run ls respectively select first, and look at the output, and think long and hard about whether the output I see is the stuff I want deleted. Only then I change the select into a delete.

Re^5: cleaning up dbi code
by roboticus (Chancellor) on Nov 26, 2010 at 23:09 UTC

    I'd guess that the rows you have left contain a null in that column, since null doesn't equal null (in the databases I use).

    ...roboticus