select rows where values equal the result of count(*) group by? I have a table like this:  



Each keyword should have 4 pieces of data. 

I want to select the keywords that have less than 4 pieces of data (less than 4 rows).

I used select count(*) from mytable group by keyword to achieve something like this:



how can I select the keywords based on the count(*) result?

Here I want the keyword b from the result grid.
You can either nest your select and use a where clause in the outer select:

select keyword 
from (
    select keyword, count(*) as cnt
    from mytable
    group by keyword
) as t
where cnt &lt; 4


or you can use having which essentially is a shorter form of the above:

select keyword
from mytable
group by keyword
having count(*) &lt; 4