2 ms·
Because of this, it's also customary to use a LIMIT just in case. For something like this, LIMIT 3 if you assume the query is correct (e.g. in production), or
by crazygringo 3y ago
Because of this, it's also customary to use a LIMIT just in case.
For something like this, LIMIT 3 if you assume the query is correct (e.g. in production), or LIMIT 4 if you're running it manually -- so that if it reports 4 rows changed instead of 3, you know you messed up somewhere, but at least you only have up to 4 rows to fix by hand, rather than an entire table.
- AntonZ234 3y agoI’m used to using limits purely in select queries, honestly I didnt event know its applicable for update queries. Still, it would probably have been after the where, and ignored too. not using transactions is probably my biggest mistake here.
- mlyle 3y agoOf course, the LIMIT is no good here because the correctly-written statement is truncated.
- cortesoft 3y agoWould not have helped, since the limit would have applied to the second statement in this case. The issue wasn’t the statement, it was the tool thinking blank line == end ststement.