VbzCart/docs/queries/qryCtg Items updates

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

Details

SQL

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

 SELECT
   NULLIF(CONCAT_WS('/',g.Code,gt.GroupCode,o.CatKey),) AS CatSfx,
   gt.ID_Title,
   g.ID AS ID_TGroup,
   gt.ID AS ID_TGTitle,
   gi.ID AS ID_TGItem,
   gt.ID_Source AS ID_TGSource,
   gi.ID_ItTyp, gi.ID_ItOpt
 FROM
 (
   (
     (
       ctg_titles AS gt LEFT JOIN ctg_groups AS g ON g.ID=gt.ID_Group
      ) LEFT JOIN qryCtg_Sources_active AS c ON gt.ID_Source=c.ID
    ) LEFT JOIN ctg_items AS gi ON gi.ID_Group=g.ID
  ) LEFT JOIN cat_ioptns AS o ON gi.ID_ItOpt=o.ID
 WHERE
   (c.ID IS NOT NULL)
     AND g.isActive
     AND gt.isActive
     AND ((gt.WhenDiscont IS NULL) OR (gt.WhenDiscont>NOW()))
     AND gi.isActive;</mysql>

<section end=sql />