Filter Your Results menu


SELECT f.SortField,, f.SortValue AS SortValue, f.SortValue AS LabelValue, f.Units AS Units, COUNT(DISTINCT (p.SKU)) AS prodCount, p.client_flag, (SELECT COUNT(pbm.pkID) FROM PromotionsByModel AS pbm INNER JOIN Rebates ON (Rebates.PromotionName = pbm.PromotionName AND Rebates.FileName <> '') WHERE pbm.pkProduct = AND pbm.EffectiveDate <= CURDATE() AND pbm.ExpirationDate > CURDATE() GROUP BY pbm.pkProduct) AS rwsPromotion, (SELECT COUNT(rbm.pkID) FROM rebatesbymodel AS rbm INNER JOIN Rebates AS r ON r.pkID = rbm.pkRebates WHERE rbm.pkProduct = p.pkID AND r.ExpirationDate > CURDATE() AND r.EffectiveDate < CURDATE() GROUP BY rbm.PromotionName) AS rwsRebates, MIN(mp.display_sequence) AS product_sequence FROM Categories AS c INNER JOIN Category_Groups AS cg ON (c.Category_Group = cg.CategoryCode) INNER JOIN menu_heading AS mh ON (cg.MenuHeading = INNER JOIN tbl_products AS p ON (p.pkCategory = c.pkID AND p.cgSlug = cg.slug AND p.mhSlug = mh.slug) INNER JOIN tbl_filters AS f ON (f.pkID = AND f.SKU = p.SKU AND f.SortField = ?) INNER JOIN Brand_Data AS bd ON (bd.pkID = p.pkBrand) INNER JOIN tbl_store_brands AS sb ON (sb.brandID = bd.pkID AND sb.categoryID = c.pkID) LEFT JOIN tbl_pricing ON tbl_pricing.SKU = p.SKU AND tbl_pricing.model_comments = 'Annapolis, MD' INNER JOIN ModelPrice AS mp ON (mp.pkProduct = p.pkID AND mp.SKU = p.SKU AND mp.Available = 1 ) WHERE ((`pbm`.`pkPromotion` = ?) and (`mp`.`Available` = ?)) GROUP BY f.SortValue ORDER BY f.ValueDisplayOrder

Unknown column 'pbm.pkPromotion' in 'where clause'