How to add multiple havingCondition with OR operator? I want to add havingCondition with OR operator

In normal sql query my having conditions are like:

group by n.nid
having comment_count!=0 OR viewed_count!=0 OR likes_count!=0;


With adding multiple havingConditions like:

$query-&gt;havingCondition('likes_count', 0, '!=');
$query-&gt;havingCondition('viewed_count', 0, '!=');
$query-&gt;havingCondition('comment_count', 0, '!=');


but It gives having condition with AND operator

Can any one please help me in.
Create OR conditions separately, in a variable, and then just use them:

$or = db_or()-&gt;condition('a', 0, '=')-&gt;condition('b', 0, '=')-&gt;condition('c', 0, '=');
$query-&gt;havingCondition($or);


For more details, read db_or documentation on Drupal API page. This should always be your first place to go, before you ask API-related questions.