VbzCart/queries/qryCtg build sub

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< VbzCart‎ | queries
Revision as of 01:57, 10 November 2010 by Woozle (talk | contribs) (appears to be unused)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Details

SQL

<mysql>CREATE OR REPLACE VIEW qryCtg_build_sub AS

 SELECT
   s.ID_Item,
   s.CatNum,
   (
     s.isActive 
     AND tg.isActive
     AND tgi.isActive
     AND (c.ID_Supercede Is Null)
      ) AS isForSale,
   c.isCloseOut,
   s.isActive,
   s.ID_Title,
   tgi.ID_ItTyp,
   tgi.ID_ItOpt,
   tgi.ID_ShipCost,
   tgi.PriceBuy,
   tgi.PriceSell,
   tgi.PriceList,
   IFNULL(tgi.Descr,CONCAT_WS(' / ',tgt.GroupDescr,o.Descr)) AS ItOpt_Descr_part,
   it.NameSng,
   s.ID_CTG_Title,
   s.ID_CTG_Item,
   tgi.Descr AS GrpItmDescr,
   tgt.GroupDescr AS TitleGroupDescr,
   o.Descr AS OptionDescr,
   s.CatSfx,
   CONCAT(tg.Sort,it.Sort,o.Sort) AS ItOpt_Sort,
   tgt.GroupCode AS GrpCode,
   tgt.GroupDescr AS GrpDescr,
   tgt.GroupSort AS GrpSort
 FROM
 ( ( ( ( (ctg_updates AS s LEFT JOIN ctg_groups AS tg ON s.ID_CTG_Group = tg.ID
          ) LEFT JOIN qry_ctg_titles_active AS tgt ON s.ID_CTG_Title = tgt.ID
        ) LEFT JOIN ctg_items AS tgi ON s.ID_CTG_Item = tgi.ID
      ) LEFT JOIN ctg_sources AS c ON tgt.ID_Source = c.ID
    ) LEFT JOIN cat_ioptns AS o ON tgi.ID_ItOpt = o.ID
  ) LEFT JOIN cat_ittyps AS it ON tgi.ID_ItTyp = it.ID;</mysql>