# Find entities with different cardinality/many values

**URL:** <https://forum.datomic.com/t/find-entities-with-different-cardinality-many-values/888>\
**Category:** Peer API\
**Created:** [March 12, 2019, 2:16pm UTC](https://forum.datomic.com/t/find-entities-with-different-cardinality-many-values/888 "2019-03-12T14:16:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cjcook](https://avatars.discourse-cdn.com/v4/letter/c/bbe5ce/32.png) [@cjcook](https://forum.datomic.com/u/cjcook)\
**Post date:** [March 12, 2019, 2:16pm UTC](https://forum.datomic.com/t/find-entities-with-different-cardinality-many-values/888/1 "2019-03-12T14:16:45Z")

</div>

Hi all, I’m trying to add a condition to a Datalog query that would limit the results to the case where a certain cardinality/many attribute has different values.

Here are some of the forms I’ve tried, with no success:

[?ourEntity :event/participants ?ourTeams]  
[?sourceEntity :event/participants ?sourceTeams]  
(not [(= ?ourTeams ?sourceTeams)])

[?ourEntity :event/participants ?ourTeams]  
[?sourceEntity :event/participants ?sourceTeams]  
[(!= ?ourTeams ?sourceTeams)]

[?ourEntity :event/participants ?ourTeams]  
[?sourceEntity :event/participants ?sourceTeams]  
(not [(.equals ^java.util.Set ?ourTeams ?sourceTeams)])

Any ideas?  
Thanks,  
Chris
