VbzCart/docs/queries/qryCtg src: Difference between revisions

From Woozle Writes Code
< VbzCart‎ | docs‎ | queries
Jump to navigation Jump to search
imported>Woozle
(t.Name AS TitleName)
imported>Woozle
(updated status)
Line 1: Line 1:
==About==
==About==
* '''Requires''': {{vbzcart/query|qryCtg_src_sub}}, {{vbzcart/query|qryCat_Titles}}
* '''Requires''': {{l/vc/query|qryCtg_src_sub}}, {{l/vc/query|qryCat_Titles}}
* '''Used by''': [[VbzCart catalog building|catalog building process]] (details to be documented)
* '''Used by''': [[VbzCart catalog building|catalog building process]] (details to be documented)
* '''History''':
* '''History''':
Line 7: Line 7:
** '''2010-12-29''' Added t.ID_Supplier because {{vbzcart|table|cat_items}} now needs that field set.
** '''2010-12-29''' Added t.ID_Supplier because {{vbzcart|table|cat_items}} now needs that field set.
** '''2011-01-02''' Added t.Name (AS TitleName) for the same reason
** '''2011-01-02''' Added t.Name (AS TitleName) for the same reason
** '''2016-03-02''' This query no longer works, and also shouldn't be needed.
* '''Fields''':
* '''Fields''':
** '''b.ItOpt_Descr_part''' apparently often comes up as "" rather than NULL, so we have to convert blanks to nulls before testing for null.
** '''b.ItOpt_Descr_part''' apparently often comes up as "" rather than NULL, so we have to convert blanks to nulls before testing for null.
==SQL==
==SQL==
<section begin=sql /><mysql>CREATE OR REPLACE VIEW qryCtg_src AS
<mysql>CREATE OR REPLACE VIEW qryCtg_src AS
SELECT
SELECT
   b.*,
   b.*,
Line 19: Line 20:
   IFNULL(NULLIF(b.ItOpt_Descr_part,""),b.NameSng) AS ItOpt_Descr
   IFNULL(NULLIF(b.ItOpt_Descr_part,""),b.NameSng) AS ItOpt_Descr
FROM qryCtg_src_sub AS b LEFT JOIN qryCat_Titles AS t ON b.ID_Title=t.ID;</mysql>
FROM qryCtg_src_sub AS b LEFT JOIN qryCat_Titles AS t ON b.ID_Title=t.ID;</mysql>
<section end=sql />

Revision as of 22:46, 2 March 2016

About

  • Requires: Template:L/vc/query, Template:L/vc/query
  • Used by: catalog building process (details to be documented)
  • History:
    • 2008-03-15 Building sequence completely rewritten, so presumably this query was created then
    • 2008-04-02 convert blanks to nulls in b.ItOpt_Descr_part
    • 2010-12-29 Added t.ID_Supplier because Template:Vbzcart now needs that field set.
    • 2011-01-02 Added t.Name (AS TitleName) for the same reason
    • 2016-03-02 This query no longer works, and also shouldn't be needed.
  • Fields:
    • b.ItOpt_Descr_part apparently often comes up as "" rather than NULL, so we have to convert blanks to nulls before testing for null.

SQL

<mysql>CREATE OR REPLACE VIEW qryCtg_src AS SELECT

 b.*,
 t.ID_Supplier,
 t.Name AS TitleName,
 CONCAT_WS('-',b.ID_Title,b.CatSfx) AS IDS_Item,
 CONCAT_WS('-',t.CatNum,b.CatSfx) AS CatNum,
 IFNULL(NULLIF(b.ItOpt_Descr_part,""),b.NameSng) AS ItOpt_Descr

FROM qryCtg_src_sub AS b LEFT JOIN qryCat_Titles AS t ON b.ID_Title=t.ID;</mysql>