VbzCart/docs/queries/qryItTypsDepts grpItems: Difference between revisions

From Woozle Writes Code
< VbzCart‎ | docs‎ | queries
Jump to navigation Jump to search
imported>Woozle
(added ID_Supplier)
m (Woozle moved page VbzCart/VbzCart/queries/qryItTypsDepts grpItems to VbzCart/docs/queries/qryItTypsDepts grpItems without leaving a redirect: part 2)
 
(No difference)

Latest revision as of 01:55, 25 February 2024

About

SQL

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

 i.ID_ItTyp, t.ID_Dept, d.ID_Supplier,

 SUM(IF(i.isForSale,1,0)) AS cntForSale,
 SUM(IF(i.isInPrint,1,0)) AS cntInPrint,
 SUM(i.qtyForSale) AS qtyForSale

FROM (qryCat_Items_Stock AS i LEFT JOIN cat_titles AS t ON i.ID_Title=t.ID) LEFT JOIN cat_depts AS d ON t.ID_Dept=d.ID GROUP BY i.ID_ItTyp, t.ID_Dept HAVING cntForSale;</mysql> <section end=sql />