Notice: Undefined index: r in /home/wmktin5/findaretailer.wmkting.com/php/findaretailer-old.php on line 10
Notice: Undefined index: s in /home/wmktin5/findaretailer.wmkting.com/php/findaretailer-old.php on line 11
Notice: Trying to get property 'product' of non-object in /home/wmktin5/findaretailer.wmkting.com/php/findaretailer-old.php on line 23
Notice: Trying to get property 'miles' of non-object in /home/wmktin5/findaretailer.wmkting.com/php/findaretailer-old.php on line 27
Notice: Trying to get property 'zipcode' of non-object in /home/wmktin5/findaretailer.wmkting.com/php/findaretailer-old.php on line 30
Notice: Trying to get property 'product-group' of non-object in /home/wmktin5/findaretailer.wmkting.com/php/findaretailer-old.php on line 37
PDO::errorInfo():
error SQL: SELECT L.Customer,
L.Name,
L.Address,
L.City,
L.State,
L.ZipCode,
L.Telephone,
L.Email,
L.Website,
L.ServiceCode,
L.DealerRating,
CAST(L.Latitude AS DECIMAL(20,14)) AS Latitude,
CAST(L.Longitude AS DECIMAL(20,14)) AS Longitude,
L.`Master`,
L.PGSC,
L.Exclude,
L.Ranking,
L.Distance,
MAX((IF(YEAR(NOW()) - YEAR(P.LastOrdered) <= 3 AND P.ProductGroup = 0, 2, IF(P.ProductGroup = 0, 1, 0)))) AS PurchasedProductGroup,
MAX((IF(YEAR(NOW()) - YEAR(P.LastOrdered) <= 3 AND P.Product = '', 2, IF(P.Product = '', 1, 0)))) AS PurchasedProduct
FROM (SELECT C.Customer,
C.Name,
C.Address,
C.City,
C.State,
C.ZipCode,
C.Telephone,
C.Email,
C.Website,
C.ServiceCode,
C.DealerRating,
CAST(C.Latitude AS DECIMAL(20,14)) AS Latitude,
CAST(C.Longitude AS DECIMAL(20,14)) AS Longitude,
C.`Master`,
(C.PackedSC & 0) AS PGSC,
(C.ExCode & 0) AS Exclude,
R.Ranking,
ROUND(3956 * 2 * ASIN(SQRT(POWER(SIN((0 -
ABS(C.Latitude)) * PI()/180 / 2),2) + COS(0
* PI()/180) * COS(ABS(C.Latitude) * PI()/180)
* POWER(SIN((0 + (-1 * C.Longitude))
* PI()/180 / 2), 2) )), 2) AS Distance
FROM Customers C
INNER JOIN Ratings R
ON C.DealerRating = R.DealerRating AND 0 = R.ProductGroup
WHERE 1 = 1
AND ((C.ExCode & 0) = 0)
GROUP BY Customer,
Name,
Address,
City,
State,
ZipCode,
Telephone,
Email,
Website,
ServiceCode,
DealerRating,
C.Latitude,
C.Longitude
HAVING Distance < ) AS L
JOIN ProductHistory P
ON L.Customer = P.Customer
GROUP BY L.Customer,
L.Name,
L.Address,
L.City,
L.State,
L.ZipCode,
L.Telephone,
L.Email,
L.Website,
L.ServiceCode,
L.DealerRating,
L.Latitude,
L.Longitude,
L.`Master`,
L.PGSC,
L.Exclude,
L.Ranking,
L.Distance
ORDER BY PurchasedProductGroup DESC, PGSC DESC, PurchasedProduct DESC, Ranking ASC, Distance, Name ASC LIMIT 5;