Query to get qualifying ProductIDs failed: Expression #1 of ORDER BY clause is not in SELECT list, references column 'www_productdb.PCD.NoImage' which is not in SELECT list; this is incompatible with DISTINCT
. SELECT DISTINCT P.ProductID FROM Product P INNER JOIN www_siteproductdb.SiteProductBVN SP ON P.ProductID = SP.ProductID INNER JOIN AttributeGroupSearch GS0 ON P.ProductID = GS0.ProductID INNER JOIN ProductConfigured PCD ON P.ProductID = PCD.ProductID WHERE P.Discontinue=0 && GS0.AttributeNVID =4502 && PCD.DefaultChoice=1 ORDER BY PCD.NoImage, P.SoldOut, P.Rank, P.RankUniqCust, P.ProductID LIMIT 0, 30