VbzCart/docs/queries/qryCat Titles Item stats

From Woozle Writes Code
< VbzCart‎ | docs‎ | queries
Revision as of 01:55, 25 February 2024 by Woozle (talk | contribs) (Woozle moved page VbzCart/VbzCart/queries/qryCat Titles Item stats to VbzCart/docs/queries/qryCat Titles Item stats without leaving a redirect: part 2)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Details

SQL

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

 ID_Title,
 ID_Dept,
 DateAdded AS WhenAdded,
 SUM(IF(i.isForSale,1,0)) AS cntForSale,
 SUM(IF(i.isInPrint,1,0)) AS cntInPrint,
 SUM(i.qtyForSale) AS qtyForSale,
 MIN(i.PriceSell) AS currMinSell,
 MAX(i.PriceSell) AS currMaxSell,
 d.ID_Supplier,
 UPPER(CONCAT_WS("-",d.CatNum,t.CatKey)) AS CatNum,
 LOWER(CONCAT_WS("/",d.CatWeb_Title,t.CatKey)) AS CatWeb,
 t.Name

FROM (qryCat_Items_Stock AS i LEFT JOIN cat_titles AS t ON i.ID_Title=t.ID) LEFT JOIN qryCat_Depts AS d ON t.ID_dept=d.ID GROUP BY i.ID_Title;</mysql> <section end=sql />