({{, (RefLink[KeyIntersection, paclet:ref/KeyIntersection])[{(Subscript[assoc, 1]),(Subscript[assoc, 2]),…}] 
generates a list of associations in which only elements whose keys appear in all the (Subscript[assoc, i]) are retained.}})

OpenersNotesSection(Spacer1)Details

(RefLink[KeyIntersection, paclet:ref/KeyIntersection]) returns a list of associations in which all the associations have keys ordered in the same way.

The keys appear in order of their first occurrence in the sequence of (Subscript[assoc, i]).

(RefLink[KeyIntersection, paclet:ref/KeyIntersection]) can be used not only on (RefLink[Association, paclet:ref/Association]) objects, but also on lists of rules.

OpenersPrimaryExamplesSection(Spacer1)Examples  (4)

OpenersExampleSection0(Spacer1)Basic Examples  (4)

Generate a list of associations with common keys:

KeyIntersection[{<|a->1,b->2|>,<|a->3,c->4|>}]

Generate associations from lists:

KeyIntersection[{{a->1,b->2},{a->3,c->4}}]

Generate associations from a mixed set:

KeyIntersection[{{a->1,b->2},<|a->3,c->4|>}]

(RefLink[KeyIntersection, paclet:ref/KeyIntersection]) reorders keys to be in the same order:

KeyIntersection[{{a->1,b->2},{b->1,a->2}}]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[KeyUnion, paclet:ref/KeyUnion])  ▪  (RefLink[JoinAcross, paclet:ref/JoinAcross])  ▪  (RefLink[KeyTake, paclet:ref/KeyTake])  ▪  (RefLink[Keys, paclet:ref/Keys])  ▪  (RefLink[Intersection, paclet:ref/Intersection])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Associations, paclet:guide/Associations])}})}})