VbzCart/queries
From HTYP, the free directory anyone can edit
< VbzCart
Contents |
[edit] Navigation
[edit] Overview
What MS Access calls "queries" are called "views" in MySQL, i.e. they pull data from existing tables and are themselves usable as data sources in much the same way that tables are (and in which result sets from functions are not).
Some common prefixes:
- qryCbx_: queries used for filling comboboxes. The unique ID will always be the first field, and the text to display will always be the second field; additional fields may be provided for use in further qryCbx_ queries which show a subset of the results.
- qryCat_: queries which build catalog numbers or information by joining multiple tables. (In Access, the convention was qryCatNum_.)
[edit] by category
[edit] Inactive
- /deprecated: queries we're trying to get rid of, once we're sure nothing uses them
- /discarded: queries apparently no longer in use
[edit] Catalog
- /qryCat_Depts
- /qryTitles_ItTyps_grpItems
- /qryTitles_ItTyps_ItTyps
- /qryTitles_ItTyps_Titles
- /qryItTypsDepts_grpItems
- /qryItTypsDepts_ItTyps
- /qryCat_Titles
- /qryCat_Titles_Item_stats
- /qryCat_Titles_web
- /qryCbx_Titles
- /qryCat_Items_Stock: cat_items with stock info
- /qryCat_pages: maps http path info to catalog entities
[edit] Catalog Items
- /qryCat_Items
- /qryCbx_Items_data
- /qryCbx_Items
- /qryCbx_Items_active
- /qryCbx_Items_for_sale
- /qryCbx_Items_opt: abbreviated version for contexts where Title is already known
- /qryItems_prices: what uses this?
[edit] Catalog Sources
- /qryCtg_Sources_active
- /qryCtg_Items_updates
- /qryCtg_Items_updates_joinable
- /qryCtg_Items_active
- /qryCtg_Titles_active
- /qryCtg_build_sub
- /qryCtg_build
- building process:
[edit] Ordering
[edit] Carts
[edit] Customers
[edit] Orders
- /qryCbx_Orders
- /qryOrderLines_notPkgd
- /qryOrders_Active
- /qryOrderLines_Active
- /qtyOrderItems_Active
- /qry_PkgItem_qtys_byOrder
- /qryOrdItms_Pkg_qtys
- /qryOrdItms_open
- /qryItms_open
- /qryItms_to_restock_union
- /qryItms_to_restock
- /qryItms_to_restock_w_info
[edit] Packages
- /qryPkgLines_byOrdLine_andItem
- /qryOrdLines_PkgdQtys
- /qryOrdLines_open
- /qryOrders_Pulled
- /qryPkgs_Pull_status
[edit] Restocks
- all restock requests:
- filtered by status:
- /qryRstks_active: not terminated = !(closed, orphaned or killed)
- /qryRstkItms_active
- /qryRstkItms_expected
- /qryRstkItms_expected_byItem - grouped by ID_Item
- /qryRstkItms_expected
- /qryRstks_unsent: created but not ordered yet
- /qryRstkItms_active
- /qryRstks_inactive: all the rest
- /qryRstks_active: not terminated = !(closed, orphaned or killed)
terminology
- Active = not "terminated", i.e. not "closed", "killed", or "orphaned" (may or may not be "expected" yet)
- Closed = received from supplier, nothing remaining on backorder
- Expected = placed with supplier, but not yet received
- Killed = canceled with supplier after having been placed
- Orphaned = we don't have records that anything was received, but nothing further is expected (usually old data)
- Terminated = closed, orphaned, or killed
- Unsent = created but not yet placed with supplier, i.e. not "expected"
phases:
| Time → | ||||
| Created | (Unsent) | Ordered | (Expected) | Closed, Killed, or Orphaned |
| --(Active)-- | --(Terminated/Inactive)-- | |||
[edit] Shipping
[edit] Stock
[edit] new queries
- /qryStk_lines_Title_info
- /qryStkItms_for_sale_wItem_data
- /qryStock_forOpenOrders
- /qryStock_byOpt_andType
- /qryStock_by_Opt_Type
- /qryStock_by_Supp_Type_Opt - unused (and should be Supp_Opt_Type)
- /qryStock_Titles_most_recent
- stock history queries:
- /qryStock_containers - generates IDS codes
- /qryStk_History - includes legacy table data
[edit] old queries
This was the first batch of queries I created, before I had decided to go with the qry prefix as in Access.
[edit] Caching
Caching should only be used for catalog display.
[edit] v_data_flow
CREATE OR REPLACE VIEW v_data_flow AS SELECT df.ID_Srce, df.ID_Dest, df.ID_Proc, dfx.doesClear FROM data_flow AS df LEFT JOIN data_procs AS dfx ON df.ID_Proc=dfx.ID ORDER BY dfx.doesClear;

