title: Using DELETE LIMIT inside TRIGGER
body: <p>How to use <code>DELETE INTO .... ORDER BY ... LIMTI</code> inside the trigger? Here this is what I try</p>
  
  <pre><code>BEGIN
      IF NEW.qty &gt; 0 THEN
          SET @QTY = 0;
          REPEAT
              INSERT stock_fifo(id, sku_id, slot_id, stock_at)
              VALUES(NEW.id, NEW.sku_id, NEW.slot_id, NEW.stock_at);
              SET @QTY = @QTY + 1;
          UNTIL @QTY &gt; NEW.qty END REPEAT;
      ELSEIF NEW.qty &lt; 0 THEN
          DELETE FROM stock_fifo
          WHERE slot_id = NEW.slot_id AND sku_id = NEW.sku_id
          ORDER BY id
          LIMIT -NEW.qty;
      END IF;
  END
  </code></pre>
  
  <p>It said there is error around</p>
  
  <p><code>LIMIT -NEW.qty</code></p>