我正在尝试这样做:
SELECT
id, user_id, roi,
(select count(id) from main_ub U where U.user_id=W.user_id and U.cons > 0) as COUNT
FROM
main_stats W
WHERE
week=43 and year=2013 and votes > 2 and COUNT >= 20
ORDER BY
roi desc
LIMIT 1
但我总是收到这个错误:
#1054 - Unknown column 'COUNT' in 'where clause'
是否可以在我的 WHERE 子句中使用内部选择?