我对我认为是计算记录的简单查询有疑问:
SELECT req_ownerid, count(req_status_lender) AS total6
FROM bor_requests
WHERE (req_status_lender = 0 AND req_status_borrower = 0) OR
(req_status_lender = 1 AND req_status_borrower = 1)
GROUP BY req_ownerid
HAVING req_ownerid = 70
我认为这将计算 (req_status_lender = 0 AND req_status_borrower = 0) 和 (req_status_lender = 1 AND req_status_borrower = 1) 的所有记录,然后给我总数,但它只给我任何一个 (req_status_lender = 0 AND req_status_borrower = 0) 或 (req_status_lender = 1 AND req_status_borrower = 1)。
任何想法我做错了什么?