我有一个查询:
SELECT b.user_id FROM users b where b.ratings_count !=
(SELECT COUNT(*) FROM
( SELECT wi.id FROM winelist_items wi
JOIN wine_rated wr
ON rate_user_id = b.user_id
AND rate_vintage_id = wi.vintage_id
AND wi.winelist_id = (SELECT id FROM winelist w
WHERE w.user_id = b.user_id LIMIT 1 )
AND wi.vintage_id !=0
)t
) limit 10;
它必须从 sql 计算的列中具有不同 rating_count 的用户中选择所有 user_id。但问题是我收到错误消息'错误代码:1054。'on 子句'中的未知列'b.user_id''。我做错了什么?非常感谢您的帮助。