我希望能够在不同的行 ID 上获得字段“计数”的总和。
下面是我的查询。我们怎样才能做到这一点?
SELECT l.sid, l.Title, u.CompanyName, l.activation_date, l.expiration_date, COUNT(s.count), COUNT(DISTINCT a.id)
FROM listings l
LEFT JOIN statistics s
ON s.object_sid = l.sid
LEFT JOIN users u
ON u.sid = l.user_sid
LEFT JOIN applications a
ON a.listing_id = l.sid
WHERE l.sid = 6276
AND s.event = 'viewListing'
GROUP BY l.sid
LIMIT 10