VbzCart/docs/queries/qryPkgs Pull status
Jump to navigation
Jump to search
About
- Notes: This query is very slow (40-45 seconds to execute)
- 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_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> <section end=sql />