ERROR :
Unknown column 'k.a1' in 'order clause'
SELECT a.store_id,
a.name,
a.address,
a.city,
a.description,
a.lg,
a.lt,
a.pic,
a.temp_pic,
a.views,
a.featured,
a.date_submitted,
a.date_approved,
a.status,
a.user_id, COUNT(DISTINCT(x.rating_id)) AS nb_ratings, ROUND(SUM(x.rating)/COUNT(x.rating_id),1) AS average_rating , COUNT(DISTINCT(z.comment_id)) AS nb_comments , COUNT(DISTINCT(t.fan_id)) AS nb_fans , y.first_name, y.last_name, y.uid, y.location, y.birth_date, j.area_id FROM _bango_stores a LEFT JOIN _bango_ratings x ON a.store_id = x.ref_id AND x.type_id = 3 LEFT JOIN _bango_comments z ON a.store_id = z.ref_id AND z.type_id = 3 LEFT JOIN _bango_fans t ON a.store_id = t.ref_id AND t.type_id = 3 LEFT JOIN _bango_users y ON (y.user_id = a.user_id) LEFT JOIN _bango_stores_areas j ON (j.main = '1' AND j.store_id = a.store_id) WHERE a.status = '1' GROUP BY a.store_id ORDER BY k.a1, k.a2, k.a3 asc LIMIT 0, 20