VbzCart/docs/procs/Upd Titles fr TitleIttyps: Difference between revisions
Jump to navigation
Jump to search
imported>Woozle (created in db) |
imported>Woozle (changed source to eliminate recursive 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 recursive loop: this→{{vbzcart|table|_titles}}→{{vbzcart|proc|Upd_TitleIttyps_fr_Titles}}→{{vbzcart|table|_title_ittyps}}→this, so changed source from {{vbzcart|table|_title_ittyps}} to {{vbzcart/query|qryCat_Titles_Item_stats}}. | |||
==SQL== | ==SQL== | ||
<section begin=sql /><mysql>DROP PROCEDURE IF EXISTS Upd_Titles_fr_TitleIttyps; | <section begin=sql /><mysql>DROP PROCEDURE IF EXISTS Upd_Titles_fr_TitleIttyps; | ||
Line 15: | Line 16: | ||
SUM(ti.cntForSale) AS cntForSale, | SUM(ti.cntForSale) AS cntForSale, | ||
SUM(ti.cntInPrint) AS cntInPrint, | SUM(ti.cntInPrint) AS cntInPrint, | ||
SUM(ti. | SUM(ti.qtyForSale) AS qtyInStock | ||
FROM | FROM qryCat_Titles_Item_stats AS ti GROUP BY ID_Title | ||
) AS ti ON ti.ID_Title=t.ID | ) AS ti ON ti.ID_Title=t.ID | ||
SET | SET |
Revision as of 21:14, 24 December 2011
About
- Purpose: Updates some fields in Template:Vbzcart
- Input: Template:Vbzcart, grouped by ID_Title
- Output: Template:Vbzcart (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 recursive loop: this→Template:Vbzcart→Template:Vbzcart→Template:Vbzcart→this, so changed source from Template:Vbzcart to Template:Vbzcart/query.
- 2010-11-10
SQL
<section begin=sql /><mysql>DROP PROCEDURE IF EXISTS Upd_Titles_fr_TitleIttyps; CREATE PROCEDURE Upd_Titles_fr_TitleIttyps()
UPDATE _titles AS t LEFT JOIN ( SELECT ID_Title, SUM(ti.cntForSale) AS cntForSale, SUM(ti.cntInPrint) AS cntInPrint, SUM(ti.qtyForSale) AS qtyInStock FROM qryCat_Titles_Item_stats AS ti GROUP BY ID_Title ) AS ti ON ti.ID_Title=t.ID SET t.cntForSale = ti.cntForSale, t.cntInPrint = ti.cntInPrint, t.qtyInStock = ti.qtyInStock;</mysql>
<section end=sql />