The optional match is like an outer join

MATCH (s:Student)
OPTIONAL MATCH (s)-[:REGISTRATIOn]->(c:Course)
WITH s, count(c) as courses
RETURN s.name, s.intelligence, courses


On Tue, Apr 12, 2016 at 12:19 PM, Marwa Elabri <marwaela...@gmail.com>
wrote:

> please can one help me to find a solution to this request
>
> i have in my database  this schema  (student)-[registration]-(course)
>
> for the node student i have the property : intillegence
> for the node course i have the property : difficulty
>
> i want to recupere the inteliggence of student those who are registrated
> and evenc those who are not registrated to courses
>
> given that i have 15 students and 4 students from them are not registrated
> and i have 27 registrations so i want to get values of intelligence of
> student
>
> the result normaly will be: 15 rows= nember of students and even for
> student that are not registrated i want to get null values
>
> i execute this match (a:student)-[b:registration]-(c:course) return
> a.intelligence
> but my problem when i execute this query i get 27 registration which is
> equal to the number of registration so i get some rows that are repeted
> which is wrong i want to get just 15 rows
> please can you help me to rectify this request
>
> thanks
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to neo4j+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to neo4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to