SELECT e.entity_id FROM entities e INNER JOIN entity_parts ep ON e.entity_id=ep.entity_id WHERE ep.part='Foo'