475: SELECT p.*, tr.tPercentage AS retailVAT, tt.tPercentage AS tradeVAT, v.*, i.* FROM sRelatedItems AS r LEFT JOIN sProducts AS p ON p.pID = r.rRelatedProductID LEFT JOIN sProductInCategory AS c ON p.pID = c.mProductID LEFT JOIN cTaxCodes AS tr ON p.pRetailVATCode = tr.tID LEFT JOIN cTaxCodes AS tt ON p.pTradeVATCode = tt.tID LEFT JOIN sProductVariants AS v ON p.pID = v.vProductID LEFT JOIN sProductPhotos AS i ON p.pID = i.iProductID WHERE p.pEnabled = 'Y' AND v.vMakeAvailable = 'Y' AND p.pID <> 88 AND ( v.vHideOutOfStock = 'N' OR ( v.vTrackStock = 'Y' AND v.vStock > 0 ) ) AND rProductID = GROUP BY v.vID ORDER BY c.mOrderInCategory, p.pName, v.vSortOrder
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GROUP BY v.vID ORDER BY c.mOrderInCategory, p.pName, v.vSortOrder' at line 13