# Database can't be passed explicitly for or/or-join clauses

**URL:** <https://forum.datomic.com/t/database-cant-be-passed-explicitly-for-or-or-join-clauses/1373>\
**Category:** Datomic Pro\
**Created:** [March 2, 2020, 4:25pm UTC](https://forum.datomic.com/t/database-cant-be-passed-explicitly-for-or-or-join-clauses/1373 "2020-03-02T16:25:47Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![nikolayandr](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.datomic.com/nikolayandr/32/375_2.png) [@nikolayandr](https://forum.datomic.com/u/nikolayandr)\
**Post date:** [March 2, 2020, 8:05pm UTC](https://forum.datomic.com/t/database-cant-be-passed-explicitly-for-or-or-join-clauses/1373/5 "2020-03-02T20:05:06Z")

</div>

Oh I got, thanks for pointing me to understand what is wrong. Actually my main case is to use different databases in OR-clauses but I see doc says: `As with rules, *src-vars* are not currently supported within the clauses of *or* , but are supported on the *or* clause as a whole at top level.` and I found something on the internet: [https://datomic.narkive.com/H6z769jM/multiple-databases-in-or](https://datomic.narkive.com/H6z769jM/multiple-databases-in-or) and on the forum: [Rules with multiple data sources?](https://forum.datomic.com/t/rules-with-multiple-data-sources/859)

Query I’m interesting is:

```
(d/q "[
  :find [?user ...] 
  :in $ $someDb
  :where 

(or-join [?user]

  (and
    [$someDb _ :user/name ?externalName1] 
    [$ ?user :user/name.EN ?externalName1]
  )

  (and
      [$someDb _ :user/name ?externalName2] 
      [$ ?user :user/name.EN ?externalName2]
   )  
 )   
 ]" (d/db conn) (d/db conn))

```

And looks like the only possible way is to rearrange query to:

```
(d/q "[
      :find [?user ...] 
      :in $ $someDb
      :where 

    [$someDb _ :user/name ?externalName1]
    [$someDb _ :user/name ?externalName2] 

    (or-join [?user]
      [?user :user/name.EN ?externalName1]
      [?user :user/name.ES ?externalName2]
    )  

]" (d/db conn) (d/db conn)) 

```

But first case could be more preferable since if first statement from **or** is true then second part is not executed what is better from performance point

---

_[View the full topic](https://forum.datomic.com/t/database-cant-be-passed-explicitly-for-or-or-join-clauses/1373)._
