Difference between revisions of "VbzCart/procs/Upd Depts fr DeptIttyps"
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
		
	
|  (created in db) |  (fixing infinite loop) | ||
| Line 7: | Line 7: | ||
| *** Added DROP PROCEDURE for easier maintenance. | *** Added DROP PROCEDURE for easier maintenance. | ||
| *** Created in database (procs were not ported from L48 to Rizzo). | *** Created in database (procs were not ported from L48 to Rizzo). | ||
| + | ** '''2011-12-24''' this was in a long recursive loop: '''this''' → {{vbzcart|table|_depts}} → {{vbzcart|proc|Upd_Titles_fr_Depts}} → {{vbzcart|table|_titles}} → {{vbzcart|proc|Upd_TitleIttyps_fr_Titles}} → {{vbzcart|table|_title_ittyps}} → {{vbzcart|proc|Upd_DeptIttyps_fr_TitleIttyps}} → {{vbzcart|table|_dept_ittyps}} → '''this''', so replacing source {{vbzcart|table|_dept_ittyps}} with {{vbzcart/query|qryCat_Titles_Item_stats}} | ||
| ==SQL== | ==SQL== | ||
| <section begin=sql /><mysql>DROP PROCEDURE IF EXISTS Upd_Depts_fr_DeptIttyps; | <section begin=sql /><mysql>DROP PROCEDURE IF EXISTS Upd_Depts_fr_DeptIttyps; | ||
| Line 15: | Line 16: | ||
|          SUM(di.cntForSale) AS cntForSale, |          SUM(di.cntForSale) AS cntForSale, | ||
|          SUM(di.cntInPrint) AS cntInPrint, |          SUM(di.cntInPrint) AS cntInPrint, | ||
| − |          SUM(di. | + |          SUM(di.qtyForSale) AS qtyInStock | 
| − |        FROM  | + |        FROM qryCat_Titles_Item_stats AS di GROUP BY ID_Dept | 
|        ) AS di ON di.ID_Dept=d.ID |        ) AS di ON di.ID_Dept=d.ID | ||
|        SET |        SET | ||
Revision as of 22:03, 24 December 2011
About
- Purpose: Updates some fields in _depts after that has been filled in by Upd_Depts_fr_Depts_Suppliers
- Input: _dept_ittyps (group by ID_Dept)
- Output: _depts (update)
- History:
- 2010-11-10
- Added DROP PROCEDURE for easier maintenance.
- Created in database (procs were not ported from L48 to Rizzo).
 
- 2011-12-24 this was in a long recursive loop: this → _depts → Upd_Titles_fr_Depts → _titles → Upd_TitleIttyps_fr_Titles → _title_ittyps → Upd_DeptIttyps_fr_TitleIttyps → _dept_ittyps → this, so replacing source _dept_ittyps with
 
- 2010-11-10
- REDIRECT Template:l/vc/query
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>