<p>I can do <code>craft.entries.section('mySection').relatedTo(item.id)</code> and it will return the result, so i assumed i could do <code>craft.entries.section(['mySection','mySection2','mySection3']).relatedTo(item.id)</code> but, the latter seems to return no results.</p>

<p>Any input would be greatly appreciated!</p>

CC BY-SA 3.0
2017-04-19T18:48:00.053Z
Are you sure the 3 sections have elements related to your `item.id`?  If you take off the `relatedTo` part, do you get all entries across all 3 sections?
Brad Bell
CC BY-SA 3.0
2017-04-19T19:52:16.077Z
Ah, now, does it mean it will return entries where they have a relationship in `mySection AND mySection2 AND mySection3` rather than the desired `mySection OR mySection2 OR mySection3` ?
John
CC BY-SA 3.0
2017-04-19T20:03:00.343Z
Without looking at the code... about 90% sure it will end up being an OR.
Brad Bell
CC BY-SA 3.0
2017-04-19T21:22:10.703Z
Well, the 3 sections do have elements related to item.id and if i take off the relatedTo part, i do indeed get entries across all 3 sections! No idea why it's not returning entries in my original code!
John
CC BY-SA 3.0
2017-04-19T22:24:00.457Z
maybe change relatedTo(item.id) to relatedTo(item)
Brad
CC BY-SA 3.0
2017-04-19T22:32:12.650Z
Yep, was one step ahead of you, i had already tried that! No dice however.
John
CC BY-SA 3.0
2017-05-18T20:34:09.957Z
Sorry - more questions. Is `item` defined? Is it an `entry` object and does the query return anything with only one section?
Clive Portman
<entries><relatedto>
relatedTo doesn't seem to work when using multiple sections in a craft.entries call
# relatedTo doesn't seem to work when using multiple sections in a craft.entries call

(Asked by: username_0 on 2017-04-19)

I can do `craft.entries.section('mySection').relatedTo(item.id)` and it will return the result, so i assumed i could do `craft.entries.section(['mySection','mySection2','mySection3']).relatedTo(item.id)` but, the latter seems to return no results.

Any input would be greatly appreciated!

**Tags:** entries, relatedto

> **Comments:**
> **username_1**: Are you sure the 3 sections have elements related to your `item.id`?  If you take off the `relatedTo` part, do you get all entries across all 3 sections?  
> **username_0**: Ah, now, does it mean it will return entries where they have a relationship in `mySection AND mySection2 AND mySection3` rather than the desired `mySection OR mySection2 OR mySection3` ?  
> **username_1**: Without looking at the code... about 90% sure it will end up being an OR.  
> **username_0**: Well, the 3 sections do have elements related to item.id and if i take off the relatedTo part, i do indeed get entries across all 3 sections! No idea why it's not returning entries in my original code!  
> **username_2**: maybe change relatedTo(item.id) to relatedTo(item)  
> **username_0**: Yep, was one step ahead of you, i had already tried that! No dice however.  
> **username_3**: Sorry - more questions. Is `item` defined? Is it an `entry` object and does the query return anything with only one section?  

---

## 0 answers

