# Syntax to set a property on nodes of multiple types?

**URL:** <https://community.neo4j.com/t/syntax-to-set-a-property-on-nodes-of-multiple-types/2253>\
**Category:** Cypher\
**Tags:** cypher\
**Created:** [October 4, 2018, 12:48am UTC](https://community.neo4j.com/t/syntax-to-set-a-property-on-nodes-of-multiple-types/2253 "2018-10-04T00:48:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rsworden59](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/rsworden59/32/935_2.png) [@rsworden59](https://community.neo4j.com/u/rsworden59)\
**Post date:** [October 4, 2018, 12:48am UTC](https://community.neo4j.com/t/syntax-to-set-a-property-on-nodes-of-multiple-types/2253/1 "2018-10-04T00:48:37Z")

</div>

Looking for a syntax like "IN [list]" that will work with multiple labels so I can set a property on every node of those types. Something like:

```auto
MATCH (n) WHERE n:Label IN [FIRST,SECOND...TENTH] SET n.prop = "true"
or
MATCH (n {Label IN [FIRST,SECOND...TENTH]}) SET n.prop = "true"

```

I can find IN syntax for properties, and I can see how to match a single node label, but I can't see how to match multiple labels. Not too bad to issue multiple commands when there are just one or two labels to affect, but when there is a long list...

Thanks.

---

<div class="post-metadata">

**Author:** ![andrew\_bowman](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/andrew_bowman/32/73_2.png) [@andrew\_bowman](https://community.neo4j.com/u/andrew_bowman)\
**Post date:** [October 4, 2018, 1:01am UTC](https://community.neo4j.com/t/syntax-to-set-a-property-on-nodes-of-multiple-types/2253/2 "2018-10-04T01:01:36Z")

</div>

This is actually a tricky one. While you could manually match on nodes of each label (`WHERE n:FIRST OR n:SECOND ...`), there isn't a good way to do this using a list of labels, as dynamic label matches aren't generally supported with Cypher (labels usually need to be hardcoded so the Cypher planner can build a plan before query execution).

That said, you could use APOC Procedures for this, allowing you to build the queries you need based on the label list. Provided you pass in a $labels parameter which is a list of labels:

```auto
UNWIND $labels as label
CALL apoc.cypher.run('MATCH (n:' + label + ') RETURN n', {}) YIELD value
WITH value.n as n
SET n.prop = true

```

Make sure the labels passed in are sanitized first, if coming (directly or indirectly) from user input, to avoid Cypher injection.
