VbzCart/docs/queries/qryStk byItem byBin

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

Details

  • Returns: Same records as Template:Vbzcart/query, but grouped by Item and Bin (so we have totals for each Item in each Bin)
  • Requires: Template:Vbzcart/query
  • Used by: Template:Vbzcart/query, VbzStockBins::Info_forItems()
  • History:
    • 2010-02-23 v_stk_lines_remaining was renamed to qryStk_lines_remaining
      • also renaming this from v_stk_byItemAndBin to qryStk_byItem_byBin

SQL

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

 SELECT
   ID_Item,
   ID_Bin,
   SUM(QtyForSale) AS QtyForSale,
   SUM(QtyForShip) AS QtyForShip,
   SUM(QtyExisting) AS QtyExisting
 FROM qryStk_lines_remaining
 GROUP BY ID_Item, ID_Bin
 HAVING SUM(QtyExisting)>0;</mysql>

<section end=sql />