I want to find all ids of which sum of group_concat is 0 . Here is simplified table from mine.
╔════╦════╦══════════════╦
║ id ║ did║ group_concat ║
╠════╬════╬══════════════╬
║ 1 ║ 1 ║ 1,1,1 ║
║ 2 ║ 1 ║ 0 ║
║ 3 ║ 2 ║ 1,-1 ║
║ 4 ║ 2 ║ 1,-1,0 ║
║ 5 ║ 2 ║ 0,0,0 ║
║ 6 ║ 3 ║ 2,-2 ║
║ 7 ║ 3 ║ 1,-1,0 ║
║ 8 ║ 3 ║ 0,0,0 ║
╚════╩════╩══════════════╩
I want to get when sum of group_concat is 0 in the same dids. If sum of group concat in any of dids is not equal to zero, it shouldn't be on the table.
Here is the table below for better understanding.
╔═════╦═════════════════════╦
║ did ║ sum of group_concat ║
╠═════╬═════════════════════╬
║ 2 ║ 0 ║
║ 3 ║ 0 ║
╚═════╩═════════════════════╩
And this is the query statement I am trying to use.
select sum(val)
from user
group by did
having sum(val) = 0
seems sum in group_concat is not available.
is there any efficient way?
thank you in advance