VbzCart/docs/procs/Upd Titles fr TitleIttyps

From Woozle Writes Code
< VbzCart‎ | docs‎ | procs
Revision as of 19:44, 8 March 2009 by imported>Woozle (New page: ==About== * '''Purpose''': Updates some fields in {{vbzcart|table|_titles}} * '''Input''': {{vbzcart|table|_title_ittyps}}, grouped by ID_Title * '''Output''': {{vbzcart|table|_titles}} (u...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

About

SQL

<section begin=sql /><mysql>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.qtyInStock) AS qtyInStock
    FROM _title_ittyps 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 />