Difference between revisions of "VbzCart/queries/qryPkgs Pull status"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to navigation Jump to search
(New page: ==About== * '''History''': ** '''2009-07-10''' Adapted from MS Access ==SQL== <section begin=sql /><mysql>CREATE OR REPLACE VIEW qryPkgs_Pull_status AS SELECT ps.*, pu.ID_Type AS ID_Pu...)
 
(very slow)
 
Line 1: Line 1:
 
==About==
 
==About==
 +
* '''Notes''': This query is '''very slow''' (40-45 seconds to execute)[[category:vbzcart/slow]]
 
* '''History''':
 
* '''History''':
 
** '''2009-07-10''' Adapted from MS Access
 
** '''2009-07-10''' Adapted from MS Access

Latest revision as of 13:24, 10 July 2009

About

  • Notes: This query is very slow (40-45 seconds to execute)
  • History:
    • 2009-07-10 Adapted from MS Access

SQL

<mysql>CREATE OR REPLACE VIEW qryPkgs_Pull_status AS SELECT

 ps.*,
 pu.ID_Type AS ID_PullType,
(pu.ID_Ord IS NOT NULL) AS IsPulled,
 IF(b.Name=r.Name,b.Name,CONCAT_WS("->",b.Name,r.Name)) AS CustName,
 IF((ar.Country IS NULL) OR IFNULL(ar.Country,"")="us",ar.Zip,ar.Country) AS Zone,
 o.ID_NameBuyer,
 o.ID_NameRecip

FROM

 (
   (
     (
       (qryPkgs_status AS ps LEFT JOIN qryOrders_Pulled AS pu ON ps.ID_Order = pu.ID_Ord)
       LEFT JOIN core_orders AS o ON ps.ID_Order=o.ID)
     LEFT JOIN qryCbx_CustNames AS r ON o.ID_NameRecip=r.ID)
   LEFT JOIN qryCbx_CustNames AS b ON o.ID_NameBuyer=b.ID)
 LEFT JOIN cust_addrs AS ar ON ar.ID=o.ID_ContactAddrRecip

ORDER BY o.Number;</mysql>