VbzCart/docs/procs/Upd Depts fr Depts Suppliers
Jump to navigation
Jump to search
About
- Purpose: fills Template:Vbzcart (does not set inPrint/inStock fields)
- Input: Template:Vbzcart, Template:Vbzcart
- Output: Template:Vbzcart (delete/insert)
SQL
<section begin=sql /><mysql>CREATE PROCEDURE Upd_Depts_fr_Depts_Suppliers()
BEGIN DELETE FROM _depts; INSERT INTO _depts(`ID`,`ID_Supp`,`CatKey`,`CatNum`,`CatWeb_Dept`,`CatWeb_Title`) SELECT d.ID, d.ID_Supplier AS ID_Supp, UPPER(IFNULL(d.PageKey,d.CatKey)) AS CatKey, UPPER(CONCAT_WS("-",s.CatKey,d.CatKey)) AS CatNum, LOWER(CONCAT_WS("/",s.CatKey,IFNULL(d.PageKey,d.CatKey))) AS CatWeb_Dept, LOWER(CONCAT_WS("/",s.CatKey,d.CatKey)) AS CatWeb_Title FROM cat_depts AS d LEFT JOIN cat_supp AS s ON d.ID_Supplier=s.ID; END</mysql>
<section end=sql />