VbzCart/queries/qryCat Items

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 19:01, 30 November 2008 by Woozle (talk | contribs) (moved from single-page listing)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Details

  • Requires: cat_items, qryCat_Titles
  • Used by: qryItms_to_restock_w_info and others
  • History:
  • MySQL note: Functions (or CONCAT, anyway) apparently do not like being separated from their opening parenthesis; it seems to resolve the function name as a field name, and (generally) will report that there is no such field.

SQL

<mysql>CREATE OR REPLACE VIEW qryCat_Items AS SELECT

 i.ID,
 i.ID_Title,
 (t.ID IS NOT NULL) AS TitleExists,
 t.ID_Supplier,
 i.PriceSell,
 i.PriceList,
 i.PriceBuy,
 i.CatNum,
 t.CatNum AS Title_CatNum,
 t.Name AS Title_Name,
 i.ID_ItTyp,
 i.ID_ItOpt,
 i.ItOpt_Descr,
 i.ItOpt_Sort,
 CONCAT(t.Name, IF
     (i.ItOpt_Descr IS NULL,,CONCAT(
       ' (',i.ItOpt_Descr,')'
       )
     )
   ) AS Descr,
 i.Supp_CatNum,
 i.isForSale,
 i.isInPrint,
 i.isPulled,
 i.QtyMin_Stk,
 t.QtyMin_Rstk AS QtyMin_Rstk_Title

FROM cat_items AS i LEFT JOIN qryCat_Titles AS t on i.ID_Title=t.ID ORDER BY t.ID IS NOT NULL, i.CatNum, i.ItOpt_Sort;</mysql>