MYSQL sum() for distinct rows

前端 未结 8 1850
太阳男子
太阳男子 2020-11-28 04:43

I\'m looking for help using sum() in my SQL query:

SELECT links.id, 
       count(DISTINCT stats.id) as clicks, 
       count(DISTINCT conversions.id) as con         


        
8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-28 05:14

    For an explanation of why you were seeing incorrect numbers, read this.

    I think that Jerome has a handle on what is causing your error. Bryson's query would work, though having that subquery in the SELECT could be inefficient.

提交回复
热议问题