自我反应。提到我要在select子句中排序的列,并对其进行别名,这是一个技巧:
SELECT
m.*, COUNT(*) as cnt
FROM
products_description pd,
products p
left outer join manufacturers m on p.manufacturers_id = m.manufacturers_id,
products_to_categories p2c
WHERE
p.products_carrot = '0' and
p.products_status = '1' and
p.products_id = p2c.products_id and
pd.products_id = p2c.products_id and
pd.language_id = '4' and
p2c.categories_id = '42'
GROUP BY p.manufacturers_id
ORDER BY cnt