title: Update another table after insert using a trigger?
body: <p>I'm currently creating some sort of inventory system.</p>
  
  <p>I have <code>tbl1</code> where in I save the items. In <code>tbl1</code>, I have column <code>qty</code> or the available stock left.</p>
  
  <p>tbl1:</p>
  
  <pre><code>id product  qty
  1  mouse    10
  2  keyboard 15
  3  monitor  8
  </code></pre>
  
  <p>I also have the table <code>tbl2</code> where in I save all the transaction in issuing items. In this table there is <code>issued_qty</code>. </p>
  
  <p>tbl2</p>
  
  <pre><code>id requested_by product  issued_qty
  1  john         mouse    2
  </code></pre>
  
  <p>My problem is how can I INSERT a row into <code>tbl2</code> at the same time UPDATE the <code>tbl1.qty (tbl1.qty - tbl2.issued_qty)</code>.</p>
  
  <p>for example:
  when I insert record in <code>tbl2</code> in requested_by, product and qty_issued, I want the <code>tbl1</code> to be automatically updated. since we issue 2 (qty) of mouse to John. the record of mouse in tbl1, should be automatically less to the no. of issued quantity in <code>tbl2</code>   </p>
  
  <p>My idea is to use <code>TRIGGER</code></p>
  
  <p>but unfortunately I have no success.. can you please help me with this one..</p>
  
  <p>thanks. </p>