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
< VbzCart‎ | queries
Revision as of 17:30, 25 February 2011 by Woozle (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

About

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

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 brs_titles_x_topics AS tt LEFT JOIN _titles AS ti ON tt.ID_Title=ti.ID WHERE ti.cntForSale>0 GROUP BY tt.ID_Topic;</mysql>