Skip to content
Advertisement

COUNT WHERE two conditions are met in the same column

I’m sure this has been asked before, but I can’t find a similar situation:

Given a table 'activity'

I need to count all users that have ‘SEM’ AND at least another channel IN contact_channel_ID

Advertisement

Answer

You can use aggregation and having:

In MySQL, the having clause can be shorted to:

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement