VbzCart/docs/procs/Upd Depts fr DeptIttyps: Difference between revisions

From Woozle Writes Code
< VbzCart‎ | docs‎ | procs
Jump to navigation Jump to search
imported>Woozle
(fixing infinite loop)
imported>Woozle
(correcting input documentation)
Line 1: Line 1:
==About==
==About==
* '''Purpose''': Updates some fields in {{vbzcart|table|_depts}} after that has been filled in by {{vbzcart|proc|Upd_Depts_fr_Depts_Suppliers}}
* '''Purpose''': Updates some fields in {{vbzcart|table|_depts}} after that has been filled in by {{vbzcart|proc|Upd_Depts_fr_Depts_Suppliers}}
* '''Input''': {{vbzcart|table|_dept_ittyps}} (group by ID_Dept)
* '''Input''': {{vbzcart/query|qryCat_Titles_Item_stats}} (group by ID_Dept)
* '''Output''': {{vbzcart|table|_depts}} (update)
* '''Output''': {{vbzcart|table|_depts}} (update)
* '''History''':
* '''History''':

Revision as of 22:04, 24 December 2011

About

SQL

<section begin=sql /><mysql>DROP PROCEDURE IF EXISTS Upd_Depts_fr_DeptIttyps; CREATE PROCEDURE Upd_Depts_fr_DeptIttyps()

   UPDATE _depts AS d LEFT JOIN (
     SELECT
       ID_Dept,
       SUM(di.cntForSale) AS cntForSale,
       SUM(di.cntInPrint) AS cntInPrint,
       SUM(di.qtyForSale) AS qtyInStock
     FROM qryCat_Titles_Item_stats AS di GROUP BY ID_Dept
     ) AS di ON di.ID_Dept=d.ID
     SET
       d.cntForSale = di.cntForSale,
       d.cntInPrint = di.cntInPrint,
       d.qtyInStock = di.qtyInStock;</mysql>

<section end=sql />