Difference between revisions of "VbzCart/queries/qryTitleTopic Title avail"

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
(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...")
 
(source table renamed)
 
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|brs_titles_x_topics}}, {{vbzcart|table|_titles}}
+
* '''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 brs_titles_x_topics AS tt
+
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 23:57, 28 September 2011

About

  • Returns: list of topics with title availability stats
  • Used by: anywhere a list of topics is displayed
  • Requires: cat_title_x_topic, _titles
  • History:
    • 2011-02-25 created for Topic listings everywhere
    • 2011-09-28 Topic tables renamed

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>