Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 0.33 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. innodb transaction and user-defined variables?
  2. START TRANSACTION;
  3. SELECT * FROM tab1 WHERE 1 LIMIT 1;
  4. DELETE FROM tab1 WHERE id="{HOW TO ACCESS ID FROM THE SELECT ABVOE?}"
  5. COMMIT;
  6.        
  7. DELETE FROM tab1 WHERE id = (SELECT id FROM tab1 LIMIT 1);
  8.        
  9. SET @result = (SELECT id FROM  tab1 LIMIT 1);
  10.  
  11. DELETE FROM tab1 WHERE id = @result;