Difference between revisions of "VbzCart/procs/Upd Titles fr TitleIttyps"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< VbzCart‎ | procs
Jump to navigation Jump to search
(changed source to eliminate recursive loop)
(corrected input documentation)
Line 1: Line 1:
 
==About==
 
==About==
 
* '''Purpose''': Updates some fields in {{vbzcart|table|_titles}}
 
* '''Purpose''': Updates some fields in {{vbzcart|table|_titles}}
* '''Input''': {{vbzcart|table|_title_ittyps}}, grouped by ID_Title
+
* '''Input''': {{vbzcart/query|qryCat_Titles_Item_stats}}, grouped by ID_Title
 
* '''Output''': {{vbzcart|table|_titles}} (update)
 
* '''Output''': {{vbzcart|table|_titles}} (update)
 
* '''History''':
 
* '''History''':

Revision as of 21:51, 24 December 2011

About

  • Purpose: Updates some fields in _titles
  • Input:
  1. REDIRECT Template:l/vc/query, grouped by ID_Title

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>