Difference between revisions of "VbzCart/queries/qryCtg src"

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
(2008-03-15)
(+ID_Supplier)
Line 5: Line 5:
 
** '''2008-03-15''' Building sequence completely rewritten, so presumably this query was created then
 
** '''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
 +
** '''2010-12-29''' Added ID_Supplier because {{vbzcart|table|cat_items}} now needs that field set.
 
* '''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.
Line 11: Line 12:
 
SELECT
 
SELECT
 
   b.*,
 
   b.*,
 +
  t.ID_Supplier,
 
   CONCAT_WS('-',b.ID_Title,b.CatSfx) AS IDS_Item,
 
   CONCAT_WS('-',b.ID_Title,b.CatSfx) AS IDS_Item,
 
   CONCAT_WS('-',t.CatNum,b.CatSfx) AS CatNum,
 
   CONCAT_WS('-',t.CatNum,b.CatSfx) AS CatNum,

Revision as of 02:52, 30 December 2010

About

  • Requires:
  1. REDIRECT Template:l/vc/query, qryCat_Titles
  • 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 ID_Supplier because cat_items now needs that field set.
  • 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,
 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>