Unknown column 'ce_attribute_5.attribute_string' in 'order clause'
Query:
SELECT
ce_products.*,
AVG(ce_ratings.rating_percentage) AS percentage,
COUNT(DISTINCT ce_reviews.review_id) AS number_reviews,
attribute_5.attribute_string AS attribute_5_attribute_string,
attribute_5.value_id AS attribute_5_value_id,
attribute_3.attribute_string AS attribute_3_attribute_string,
attribute_3.value_id AS attribute_3_value_id,
attribute_4.attribute_string AS attribute_4_attribute_string,
attribute_4.value_id AS attribute_4_value_id,
attribute_6.attribute_string AS attribute_6_attribute_string,
attribute_6.value_id AS attribute_6_value_id,
attribute_7.attribute_string AS attribute_7_attribute_string,
attribute_7.value_id AS attribute_7_value_id
FROM
ce_products
INNER JOIN ce_products_categories ON ce_products.product_id = ce_products_categories.product_id
LEFT JOIN ce_attributes attribute_5 ON attribute_5.field_id = 5 AND attribute_5.product_id = ce_products.product_id
LEFT JOIN ce_attributevalues attributevalue_5 ON attribute_5.value_id = attributevalue_5.value_id
LEFT JOIN ce_attributes attribute_3 ON attribute_3.field_id = 3 AND attribute_3.product_id = ce_products.product_id
LEFT JOIN ce_attributevalues attributevalue_3 ON attribute_3.value_id = attributevalue_3.value_id
LEFT JOIN ce_attributes attribute_4 ON attribute_4.field_id = 4 AND attribute_4.product_id = ce_products.product_id
LEFT JOIN ce_attributevalues attributevalue_4 ON attribute_4.value_id = attributevalue_4.value_id
LEFT JOIN ce_attributes attribute_6 ON attribute_6.field_id = 6 AND attribute_6.product_id = ce_products.product_id
LEFT JOIN ce_attributevalues attributevalue_6 ON attribute_6.value_id = attributevalue_6.value_id
LEFT JOIN ce_attributes attribute_7 ON attribute_7.field_id = 7 AND attribute_7.product_id = ce_products.product_id
LEFT JOIN ce_attributevalues attributevalue_7 ON attribute_7.value_id = attributevalue_7.value_id
LEFT JOIN ce_reviews ON ce_products.product_id = ce_reviews.product_id
LEFT JOIN ce_ratings ON ce_reviews.review_id = ce_ratings.review_id
WHERE
ce_products.product_isactive = 1 AND ce_products_categories.category_id = :categoryid
GROUP BY
ce_products.product_id
ORDER BY
CONVERT(ce_attribute_5.attribute_string, SIGNED), ce_attributevalue_5.value_name, ce_products.product_name