VbzCart/docs/queries/qryTitles Item info

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

About

SQL

<section begin=sql /><mysql>CREATE OR REPLACE VIEW qryTitles_Item_info AS SELECT

 t.*,
 COUNT(i.ID) AS cntItems,
 SUM(s.QtyForSale) AS qtyForSale,
 SUM(i.isForSale) AS cntForSale,
 SUM(i.isInPrint) AS cntInPrint,
 MIN(i.PriceSell) AS dlrMinSell,
 MAX(i.PriceSell) AS dlrMaxSell

FROM (cat_titles AS t

 LEFT JOIN cat_items AS i ON i.ID_Title=t.ID)
 LEFT JOIN qryStk_items_remaining AS s ON i.ID=s.ID_Item

GROUP BY t.ID; </mysql> <section end=sql />