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

From Woozle Writes Code
< VbzCart‎ | docs‎ | queries
Jump to navigation Jump to search
imported>Woozle
(extracted from catalog building page)
 
imported>Woozle
(2008-03-15)
Line 3: Line 3:
* '''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''':
** '''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
** '''2008-04-02''' convert blanks to nulls in b.ItOpt_Descr_part
* '''Fields''':
* '''Fields''':

Revision as of 22:19, 3 May 2009

About

  • Requires: Template:Vbzcart/query, Template:Vbzcart/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
  • 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

<section begin=sql /><mysql>CREATE OR REPLACE VIEW qryCtg_src AS SELECT

 b.*,
 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> <section end=sql />