 <p>What is the logic that you want?</p> <p>Let me guess that you want Mexicans with more than 3 children, Americans with 2, and Japanese with 1. In this case, you would something like:</p> <pre><code>having (case when count(nationality = 'Mexican' then children end) &gt; 3 then 'true' when count(nationality = 'American' then children end) = 2 then 'true' when count(nationality = 'Japanese' then children end) = 1 then 'true' end) = 'true' </code></pre> <p>However, even this seems strange. Why are you counting "children". What are you grouping on? If children is just a field in the data, then this should be a WHERE clause instead of a HAVING clause:</p> <pre><code>where (nationality = 'Mexican' and children end &gt; 3) or (nationality = 'American' and children = 2) or (nationality = 'Japanese' and children = 1) </code></pre>