How to list entries related to a category + related to a section? Sorry if this has been asked before. I've searched for other relatedTo questions but could not find anything similar. 

I have 2 sections (each having 1 entry type):


games
reviews


Games are linked to 1 or more categories using a Categories field.
Reviews are linked to 1 or more games using an Entries field.

On a category page I can list all related games using:

craft.entries({section: 'games'}).relatedTo(category)


I do however want to list all games inside a category that have at least 1 review. I tried something like

craft.entries({section: 'games'}).relatedTo(category).relatedTo(craft.entries.section('reviews'))


but that lists all games having a review regardless of the category. How to solve this?
When you call this:



craft.entries({section: 'games'}).relatedTo(category).relatedTo(craft.entries.section('reviews'))


that second relatedTo param is just overriding the first one. Lucky for you, that parameter does accept multiple criteria (see the “Passing Multiple Relation Criteria” section on http://buildwithcraft.com/docs/relations#the-relatedTo-param).

{% set games = craft.entries({
    section: 'games',
    relatedTo: ['and',
        category,
        craft.entries.section('reviews').status(null)
    ]
}) %}


It's a good idea to specify that category will be a target element (where the Games entries did the selecting), and that the Reviews will be source elements (where the Games were selected by the Reviews), as this will slim the DB query down a bit:

{% set games = craft.entries({
    section: 'games',
    relatedTo: ['and',
        { targetElement: category },
        { sourceElement: craft.entries.section('reviews').status(null) }
    ]
}) %}