VbzCart/docs/queries/qryStk History: Difference between revisions

From Woozle Writes Code
< VbzCart‎ | docs‎ | queries
Jump to navigation Jump to search
imported>Woozle
(New page: ==About== * '''Purpose''': {{vbzcart/table|stk_history}} plus {{vbzcart/table|stk_history_legacy}} data, if any, with IDs adjusted to prevent duplicates. Lets you see the complete history ...)
 
imported>Woozle
(+ORDER BY ID)
Line 3: Line 3:
* '''History''':
* '''History''':
** '''2008-12-29''' Created
** '''2008-12-29''' Created
** '''2008-12-30''' Added "ORDER BY ID" so everything will be in sequence (apparently ORDER BY is assumed to refer to the whole UNION, and can't be used within the individual SELECTs that go into the UNION)
==SQL==
==SQL==
<section begin=sql /><mysql>CREATE OR REPLACE VIEW qryStk_History AS
<section begin=sql /><mysql>CREATE OR REPLACE VIEW qryStk_History AS
Line 24: Line 25:
   What,
   What,
   Notes
   Notes
   FROM stk_history_legacy;
   FROM stk_history_legacy
</mysql>
ORDER BY ID;</mysql>
<section end=sql />
<section end=sql />

Revision as of 17:08, 30 December 2008

About

  • Purpose: Template:Vbzcart/table plus Template:Vbzcart/table data, if any, with IDs adjusted to prevent duplicates. Lets you see the complete history including legacy stuff, without polluting the main log with non-fixable legacy data.
  • History:
    • 2008-12-29 Created
    • 2008-12-30 Added "ORDER BY ID" so everything will be in sequence (apparently ORDER BY is assumed to refer to the whole UNION, and can't be used within the individual SELECTs that go into the UNION)

SQL

<section begin=sql /><mysql>CREATE OR REPLACE VIEW qryStk_History AS SELECT * FROM stk_history UNION SELECT

 CAST(ID-5000 AS SIGNED) AS ID,
 ID_StkBin,
 ID_StkLine,
 CH_OthType,
 ID_OthCont,
 ID_OthLine,
 IDS_OthCont,
 ID_Item,
 QtyBefore,
 QtyAdded,
 QtyAfter,
 QtyBinBefore,
 QtyBinAfter,
 `When`,
 What,
 Notes
 FROM stk_history_legacy

ORDER BY ID;</mysql> <section end=sql />