MYSQL sum() for distinct rows
- by makeee
I'm looking for help using sum() in my SQL query (not posting full query since the scenario is fairly simple).
I have COUNT(DISTINCT conversions.id) in my query. I use DISTINCT because I'm doing "group by" for multiple columns and this ensures the same row is not counted more than once.
Now I want to add:
SUM(conversions.value) as conversion_value
The problem is that the "value" for each row is counted more than once (due to the multiple group bys)
I basically want to do SUM(conversions.value) for each DISTINCT conversions.id.
Is that possible?