VbzCart/docs/queries/qryPkgs Pull status: Difference between revisions
Jump to navigation
Jump to search
imported>Woozle (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...) |
imported>Woozle (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 |
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
<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 />