# Condition Based Output

**URL:** <https://community.neo4j.com/t/condition-based-output/41637>\
**Category:** Cypher\
**Created:** [July 19, 2021, 10:56am UTC](https://community.neo4j.com/t/condition-based-output/41637 "2021-07-19T10:56:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vence\_andersen1](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/vence_andersen1/32/19186_2.png) [@vence\_andersen1](https://community.neo4j.com/u/vence_andersen1)\
**Post date:** [July 19, 2021, 10:56am UTC](https://community.neo4j.com/t/condition-based-output/41637/1 "2021-07-19T10:56:12Z")

</div>

![MVIMG_20210719_140246](https://us1.discourse-cdn.com/flex021/uploads/neo4jcommunity/original/3X/e/4/e40330fdfaecc40fc237c1a31283a445eb0b4f33.jpeg)

As you see in image, A is connected to B,C,F,G. When I query A like "Match (n:Label{Name:'Name'})", it's actually returning me B,C,F,G which is right, but I want "B" to be returned only if I query "A","D","E", like if the values of A,D,E are true.

Here D, E could be connected to something else, but when the values of A,D and E are true only then B should be given. Can I achieve that?

---

<div class="post-metadata">

**Author:** ![Cobra](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/cobra/32/35243_2.png) [@Cobra](https://community.neo4j.com/u/Cobra)\
**Post date:** [July 20, 2021, 6:11am UTC](https://community.neo4j.com/t/condition-based-output/41637/2 "2021-07-20T06:11:26Z")

</div>

Hello @vence_andersen1 🙂

Did you have a look at [CASE expression](https://neo4j.com/docs/cypher-manual/current/syntax/expressions/) and [APOC conditional cypher execution](https://neo4j.com/labs/apoc/4.3/cypher-execution/conditionals/)?

Regards,  
Cobra

---

<div class="post-metadata">

**Author:** ![vence\_andersen1](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/vence_andersen1/32/19186_2.png) [@vence\_andersen1](https://community.neo4j.com/u/vence_andersen1)\
**Post date:** [July 25, 2021, 10:45am UTC](https://community.neo4j.com/t/condition-based-output/41637/3 "2021-07-25T10:45:11Z")

</div>

Yeah, but what I am trying here is, when I query "A" like "Match (n:label{Name:'A'}) return n", I need the output to show only A and when I expand it's nodes I need to get only "C","F" and "G". Is that possible?

Like "B" should be given only when I query "A","D" and "E" at the same time.
