header image with round borders
 

MySQL EXPLAIN aka DESCRIBE for UPDATE/DELETE

September 21st, 2008 @biophonc

Ever tryed to “explain” a delete or an update statement? It will fail. It took me nearly an hour to figure this out. Actually I’ve never needed to explain a simple DELETE statement, but in todays case I did and was wondering why my query always failed. It is too bad that there is no such “feature”. With InnoDB you can use of course the ON DELETE/UPDATE stuff but in my case I didn’t want to alter the existing DB.

However, if you need to delete multiple rows over multiple tables, you may do something like this: ;)

DELETE stats, links, logins
FROM promo_stats AS stats
LEFT JOIN promo_links AS links USING(promo_link_id)
LEFT JOIN promo_logins AS logins USING(promo_login_id)
WHERE stats.promo_item_id=6;

One Response to “MySQL EXPLAIN aka DESCRIBE for UPDATE/DELETE”

  1. ferraminnoff Says:


    Yes undoubtedly, in some moments I can bruit about that I acquiesce in with you, but you may be considering other options.
    to the article there is stationary a without question as you did in the decrease issue of this request http://www.google.com/ie?as_q=agnitum outpost security suite pro 2008 6.0.2284 ?
    I noticed the utter you procure not used. Or you profit by the dreary methods of inspiriting of the resource. I have a week and do necheg
    Your Ferrdenants :)


 

» Leave a Reply

*
*
 

» Categories

footer image with round borders