MySQL query - using SUM of COUNT

后端 未结 5 978
刺人心
刺人心 2021-01-07 16:27

This query:

SELECT COUNT(source) AS count
FROM call_details
GROUP BY source
HAVING count >1

Returns about 1500 (the number I\'m looking

5条回答
  •  醉话见心
    2021-01-07 16:56

    Just simply remove the 'Group by' clause in the select query that counts

    # first, get your counts by source
    SELECT COUNT(source) AS count
    FROM call_details
    GROUP BY source
    HAVING count >1
    
    # then, get the overall total
    SELECT COUNT(source) AS count
    FROM call_details
    HAVING count >1
    

提交回复
热议问题