VbzCart/docs/queries/ cat pages

From Woozle Writes Code
< VbzCart‎ | docs‎ | queries
Jump to navigation Jump to search

About

SQL

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

 SELECT
   CONCAT_WS('-','S',ID) AS AB,
   LOWER(CatKey) AS Path,
   ID,
   'S' AS Type
 FROM cat_supp
 UNION
 SELECT
   CONCAT_WS('-','D',ID) AS AB,
   LOWER(CatWeb_Dept) AS Path,
   ID,
   'D' AS Type
 FROM qryCat_Depts
 UNION
 SELECT
   CONCAT_WS('-','T',ID) AS AB,
   REPLACE(LOWER(CatWeb),'-','/') AS Path,
   ID,
   'T' AS Type
 FROM qryCat_Titles
 UNION
 /* image pages (every size except thumbnail and small) */
 SELECT
   CONCAT_WS('-','I',i.ID) AS AB,
   LOWER(CONCAT_WS('/',REPLACE(t.CatWeb,'-','/'),AttrFldr,i.Ab_Size)) AS Path,
   i.ID,
   'I' AS Type
 FROM cat_images AS i LEFT JOIN qryCat_Titles AS t ON i.ID_Title=t.ID WHERE (i.isActive) AND (i.Ab_Size NOT IN ('th','sm'));</mysql>

<section end=sql />