Difference between revisions of "VbzCart/queries"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to navigation Jump to search
(→‎new queries: showing proper dependency for qryStkItms_for_sale)
(→‎new queries: many more queries no longer in db)
 
(22 intermediate revisions by the same user not shown)
Line 14: Line 14:
 
===Catalog===
 
===Catalog===
 
* [[/qryCat_Depts]]
 
* [[/qryCat_Depts]]
* [[/qryTitles_ItTyps_grpItems]]
+
* '''Title'''-centric:
* [[/qryTitles_ItTyps_ItTyps]]
+
** [[/qryTitles_Item_info]]
* [[/qryTitles_ItTyps_Titles]]
+
** [[/qryTitles_ItTyps_grpItems]]
* [[/qryItTypsDepts_grpItems]]
+
** [[/qryTitles_ItTyps_ItTyps]]
* [[/qryItTypsDepts_ItTyps]]
+
** [[/qryTitles_ItTyps_Titles]]
* [[/qryCat_Titles]]
+
** [[/qryTitles_Imageless]] - titles with no active images
* [[/qryCat_Titles_Item_stats]]
+
** [[/qryCat_Titles]]
* [[/qryCat_Titles_web]]
+
** [[/qryCat_Titles_Item_stats]] -- item/stock statistics
* [[/qryCbx_Titles]]
+
** [[/qryCat_Titles_Item_count]] -- simpler query for maintenance
* [[/qryCat_Items_Stock]]: cat_items with stock info
+
** [[/qryCat_Titles_web]]
 +
** [[/qryCbx_Titles]]
 +
* '''Item'''-centric:
 +
** [[/qryCat_Items_Stock]]: cat_items with stock info
 +
* '''ItTyp'''-centric:
 +
** [[/qryItTypsDepts_grpItems]]
 +
** [[/qryItTypsDepts_ItTyps]]
 +
* '''Image'''-centric:
 +
** [[/qryImgs_byTitle]]: Image info by Title
 
* [[/qryCat_pages]]: maps http path info to catalog entities
 
* [[/qryCat_pages]]: maps http path info to catalog entities
 
====Catalog Items====
 
====Catalog Items====
* [[/qryCat_Items]]
 
 
* [[/qryCbx_Items_data]]
 
* [[/qryCbx_Items_data]]
 
** [[/qryCbx_Items]]
 
** [[/qryCbx_Items]]
Line 38: Line 45:
 
* [[/qryCtg_Items_updates_joinable]]
 
* [[/qryCtg_Items_updates_joinable]]
 
* [[/qryCtg_Items_active]]
 
* [[/qryCtg_Items_active]]
* [[/qryCtg_Titles_active]]
+
* <s>[[/qryCtg_build_sub]]</s>
* [[/qryCtg_build_sub]]
+
* <s>[[/qryCtg_build]]</s>
* [[/qryCtg_build]]
 
 
* '''[[VbzCart catalog building|building]] process''':
 
* '''[[VbzCart catalog building|building]] process''':
** [[/qryCtg_src]]
 
** [[/qryCtg_src_sub]]
 
 
** [[/qryCtg_Items_forUpdJoin]]
 
** [[/qryCtg_Items_forUpdJoin]]
 
** [[/qryCtg_Upd_join]]
 
** [[/qryCtg_Upd_join]]
Line 49: Line 53:
 
** [[/qryCtgCk_dup_keys]]
 
** [[/qryCtgCk_dup_keys]]
  
 +
====Catalog Topics====
 +
* '''titles x topics''':
 +
** [[/qryTitleTopic_Titles]]: more title information
 +
** [[/qryTitleTopic_Topics]]: more topic information
 +
** [[/qryTitleTopic_Title_avail]]: title availability information
 
===Ordering===
 
===Ordering===
 
====Carts====
 
====Carts====
Line 69: Line 78:
 
* [[/qryItms_to_restock_union]]
 
* [[/qryItms_to_restock_union]]
 
* [[/qryItms_to_restock]]
 
* [[/qryItms_to_restock]]
* [[/qryItms_to_restock_w_info]]
 
 
====Packages====
 
====Packages====
 
* [[/qryPkgLines_byOrdLine_andItem]]
 
* [[/qryPkgLines_byOrdLine_andItem]]
Line 76: Line 84:
 
* [[/qryOrders_Pulled]]
 
* [[/qryOrders_Pulled]]
 
* [[/qryPkgs_Pull_status]]
 
* [[/qryPkgs_Pull_status]]
 +
* for reports:
 +
** [[/qryRpt_Pkg_Lines]]
 +
*** [[/qryPkgLines_qtys_done]]
 +
*** <s>[[/qryPkgLines_qtys_done_ord_sum]]</s> - not used
 +
** [[/qryRpt_Pkg_Trx]]
 +
 
====Restocks====
 
====Restocks====
 
* '''all restock requests''':
 
* '''all restock requests''':
Line 81: Line 95:
 
** [[/qryRstkReq_Item_Rcd_status]]
 
** [[/qryRstkReq_Item_Rcd_status]]
 
** [[/qryRstkReq_Item_status]]
 
** [[/qryRstkReq_Item_status]]
** [[/qryRstkReq_Item_status_Req_info]]
+
*** [[/qryRstkReq_Item_status_Req_info]]
 +
*** [[/qryRstkReq_Items_expected]]: show only expected items
 
** [[/qryCbx_RstkReq]]
 
** [[/qryCbx_RstkReq]]
 
*** [[/qryRstkReq_by_status]]
 
*** [[/qryRstkReq_by_status]]
 
*** [[/qryRstkReq_by_PurchOrd]]
 
*** [[/qryRstkReq_by_PurchOrd]]
* '''active restocks''':
+
* '''filtered by status''':
** [[/qryRstks_active]]: not terminated = !(closed, orphaned or killed)
+
** [[/qryRstks_active]]: not terminated = !(closed, orphaned or killed - see {{l/vc/term|restock/status}})
** [[/qryRstkItms_active]]
+
*** [[/qryRstks_unsent]]: created but not ordered yet
** [[/qryRstks_unsent]]: created but not ordered yet
+
**** [[/qryRstkItms_unsent]]
** [[/qryRstkItms_unsent]]
+
***** [[/qryRstkItms_unsent_for_order]]
** [[/qryRstkItms_unsent_for_order]]
+
** [[/qryRstks_inactive]]: all the rest
** [[/qryRstkItms_expected]]
 
  
'''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''':
 
{| border=1
 
|-
 
| colspan=5 | Time &rarr;
 
|-
 
| '''Created''' || (Unsent) || '''Ordered''' || (Expected) || '''Closed''', '''Killed''', or '''Orphaned'''
 
|-
 
| colspan=4 align=center | --(Active)-- || align=center | --(Terminated)--
 
|}
 
 
====Shipping====
 
====Shipping====
 
* [[/qryPkgs_status]]
 
* [[/qryPkgs_status]]
Line 120: Line 117:
 
** [[/qryStk_lines_remaining_forSale]]
 
** [[/qryStk_lines_remaining_forSale]]
 
*** [[/qryStkItms_for_sale]]
 
*** [[/qryStkItms_for_sale]]
** [[/qryStk_items_remaining]]
+
 
 +
* [[/qryStk_items_remaining]]
 +
* [[/qryStk_byItem_byBin]]
 +
 
 
* [[/qryStk_lines_Title_info]]
 
* [[/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]]
 
* {{vbzcart/table|stk_history|stock history}} queries:
 
** [[/qryStock_containers]] - generates IDS codes
 
** [[/qryStk_History]] - includes {{vbzcart/table|stk_history_legacy|legacy table}} data
 
  
 
====old queries====
 
====old queries====
 
This was the first batch of queries I created, before I had decided to go with the qry prefix as in Access.
 
This was the first batch of queries I created, before I had decided to go with the qry prefix as in Access.
 
* [[/v_stk_titles_remaining]]
 
* [[/v_stk_titles_remaining]]
* [[/v_stk_byItemAndBin]]
 
 
* [[/v_stk_byItemAndBin_wItemInfo]]
 
* [[/v_stk_byItemAndBin_wItemInfo]]
* [[/v_stk_byItemAndBin_wInfo]]
 
  
 
===Caching===
 
===Caching===
 
Caching should only be used for catalog display.
 
Caching should only be used for catalog display.
====v_data_flow====
+
* [[/qryCache_Flow_Procs]]
<section begin=sql /><mysql>  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;</mysql>
 
<section end=sql />
 

Latest revision as of 23:12, 3 March 2016

Navigation

VbzCart: data views

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_.)

by category

Inactive

Catalog

Catalog Items

Catalog Sources

Catalog Topics

Ordering

Carts

Customers

Orders

Packages

Restocks

Shipping

Stock

new queries

old queries

This was the first batch of queries I created, before I had decided to go with the qry prefix as in Access.

Caching

Caching should only be used for catalog display.