VbzCart/docs/queries/qryTitleTopic Title avail: Difference between revisions
Jump to navigation
Jump to search
imported>Woozle (Created page with "==About== * '''Returns''': list of topics with title availability stats * '''Used by''': anywhere a list of topics is displayed * '''Requires''': {{vbzcart|table|brs_titles_x_top...") |
m (Woozle moved page VbzCart/VbzCart/queries/qryTitleTopic Title avail to VbzCart/docs/queries/qryTitleTopic Title avail without leaving a redirect: part 3/5) |
||
(One intermediate revision by one other user not shown) | |||
Line 2: | Line 2: | ||
* '''Returns''': list of topics with title availability stats | * '''Returns''': list of topics with title availability stats | ||
* '''Used by''': anywhere a list of topics is displayed | * '''Used by''': anywhere a list of topics is displayed | ||
* '''Requires''': {{vbzcart|table| | * '''Requires''': {{vbzcart|table|cat_title_x_topic}}, {{vbzcart|table|_titles}} | ||
* '''History''': | * '''History''': | ||
** '''2011-02-25''' created for Topic listings everywhere | ** '''2011-02-25''' created for Topic listings everywhere | ||
** '''2011-09-28''' Topic tables renamed | |||
==SQL== | ==SQL== | ||
<section begin=sql /><mysql>CREATE OR REPLACE VIEW qryTitleTopic_Title_avail AS | <section begin=sql /><mysql>CREATE OR REPLACE VIEW qryTitleTopic_Title_avail AS | ||
Line 12: | Line 13: | ||
SUM(ti.cntInPrint) AS cntInPrint, | SUM(ti.cntInPrint) AS cntInPrint, | ||
SUM(ti.qtyInStock) AS qtyInStock | SUM(ti.qtyInStock) AS qtyInStock | ||
FROM | FROM cat_title_x_topic AS tt | ||
LEFT JOIN _titles AS ti | LEFT JOIN _titles AS ti | ||
ON tt.ID_Title=ti.ID | ON tt.ID_Title=ti.ID |
Latest revision as of 01:56, 25 February 2024
About
- Returns: list of topics with title availability stats
- Used by: anywhere a list of topics is displayed
- Requires: Template:Vbzcart, Template:Vbzcart
- History:
- 2011-02-25 created for Topic listings everywhere
- 2011-09-28 Topic tables renamed
SQL
<section begin=sql /><mysql>CREATE OR REPLACE VIEW qryTitleTopic_Title_avail AS SELECT
tt.ID_Topic, SUM(ti.cntForSale) AS cntForSale, SUM(ti.cntInPrint) AS cntInPrint, SUM(ti.qtyInStock) AS qtyInStock
FROM cat_title_x_topic AS tt LEFT JOIN _titles AS ti ON tt.ID_Title=ti.ID WHERE ti.cntForSale>0 GROUP BY tt.ID_Topic;</mysql> <section end=sql />