VbzCart/docs/procs/Upd Titles fr TitleIttyps

From Woozle Writes Code
< VbzCart‎ | docs‎ | procs
Jump to navigation Jump to search

About

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>