Querieng Parent-child

How can I query parents by child attributes? specifically statistics of these attributes?

example: Get all parents that have at least 3 children with a specific value in a specific field?

more specific example: all authors that have at least two books with the horror tag