Difference between revisions of "VbzCart/queries/deprecated"
Jump to navigation
Jump to search
(moved from single-page listing) |
(v_rstk_lines_wItemInfo) |
||
| Line 29: | Line 29: | ||
tx.qtyInStock | tx.qtyInStock | ||
FROM titles AS t LEFT JOIN _titles AS tx on t.ID=tx.ID;</mysql> | FROM titles AS t LEFT JOIN _titles AS tx on t.ID=tx.ID;</mysql> | ||
| + | ==v_rstk_lines_wItemInfo== | ||
| + | * '''Status''': deprecated (uses old restock tables); can probably be deleted, since nothing should be using those tables anymore. | ||
| + | <mysql>CREATE OR REPLACE VIEW v_rstk_lines_wItemInfo AS | ||
| + | SELECT | ||
| + | ri.*, | ||
| + | i.ID_Title, | ||
| + | IFNULL(r.WhenOrdered,r.WhenCreated) AS WhenDone | ||
| + | FROM | ||
| + | (rstk_lines AS ri | ||
| + | LEFT JOIN cat_items AS i ON ri.ID_Item=i.ID) | ||
| + | LEFT JOIN core_restocks AS r ON ri.ID_Restock=r.ID;</mysql> | ||
Revision as of 23:50, 3 December 2008
v_titles - latest
Deprecated -- use VbzCart/queries/qryCat_Titles_Item_stats instead -- this query still depends on cached _depts table. To be eliminated later.
<mysql>CREATE OR REPLACE VIEW v_titles AS SELECT
ID_Title,
ID_Dept,
SUM(IF(i.isForSale,1,0)) AS cntForSale,
SUM(IF(i.isInPrint,1,0)) AS cntInPrint,
SUM(i.qtyInStock) AS qtyInStock,
MIN(i.PriceSell) AS currMinSell,
MAX(i.PriceSell) AS currMaxSell,
d.ID_Supp,
UPPER(CONCAT_WS("-",d.CatNum,t.CatKey)) AS CatNum,
LOWER(CONCAT_WS("/",d.CatWeb_Title,t.CatKey)) AS CatWeb,
t.Name
FROM (cat_items AS i LEFT JOIN cat_titles AS t ON i.ID_Title=t.ID) LEFT JOIN _depts AS d ON t.ID_dept=d.ID GROUP BY i.ID_Title;</mysql>
v_titles - older
Old version which depends on 2 cached tables (trying to minimize usage of these): <mysql>CREATE OR REPLACE VIEW v_titles AS
SELECT
t.*,
tx.ID_Supp,
tx.CatNum,
tx.CatWeb,
tx.cntForSale,
tx.cntInPrint,
tx.qtyInStock
FROM titles AS t LEFT JOIN _titles AS tx on t.ID=tx.ID;</mysql>
v_rstk_lines_wItemInfo
- Status: deprecated (uses old restock tables); can probably be deleted, since nothing should be using those tables anymore.
<mysql>CREATE OR REPLACE VIEW v_rstk_lines_wItemInfo AS SELECT
ri.*, i.ID_Title, IFNULL(r.WhenOrdered,r.WhenCreated) AS WhenDone
FROM
(rstk_lines AS ri LEFT JOIN cat_items AS i ON ri.ID_Item=i.ID) LEFT JOIN core_restocks AS r ON ri.ID_Restock=r.ID;</mysql>