我有两张桌子
requests - request_id, request_message, user_id
responses - response_id, request_id, response_message, user_id, status
我正在运行此查询以获取属于特定用户的未读响应的计数。
SELECT COUNT(*)
FROM RESPONSES
WHERE status = 'U'
and request_id IN ( SELECT request_id FROM requests WHERE user_id = '$User_id')
有什么方法可以使用join来优化它吗?