Munmud opened a new issue, #951:
URL: https://github.com/apache/age/issues/951

   How to use WHERE caluse after a (WITH .. AS ...)
   The following query fails whenever I add WHERE caluse inside it
   ```sql
   SELECT * from cypher('munmud', $$
   MATCH (u:User {id: 'user1'})-[:WATCHED]->(m:Movie)
   WITH DISTINCT m as watchedMovies
        MATCH (g:Genre)<-[]-(watchedMovies)
        WITH DISTINCT g as genre
                MATCH (genre)<-[:BELONGS_TO]-(am)
                WITH DISTINCT am as allMovie
                        WHERE (u:User {id: 'user1'})-[:WATCHED]->(allMovie)
                        RETURN allMovie
   $$) as (V agtype);
   ```
   ### Result
   ```
   Syntax error at or near ":"
   ```
   
   ### Nodes Added as follow 
   ```sql
   SELECT * from cypher('munmud', $$
   CREATE 
   (:User {id: 'user1'}),
   (:User {id: 'user2'}),
   (:Movie {id: 'movie1', name: 'The Shawshank Redemption'}),
   (:Movie {id: 'movie2', name: 'The Godfather'}),
   (:Movie {id: 'movie3', name: 'The Dark Knight'}),
   (:Movie {id: 'movie4', name: 'Army of Thieves'}),
   (:Movie {id: 'movie5', name: 'Oceans Thirteen'}),
   (:Movie {id: 'movie6', name: 'Heat'}),
   (:Genre {name: 'Drama'}),
   (:Genre {name: 'Crime'}),
   (:Genre {name: 'Action'})
   $$) as (V agtype);
   
   ```
   
   ### Edges added as follow 
   ```sql
   SELECT * from cypher('munmud', $$
   
   MATCH 
   (u1:User {id: 'user1'}), 
   (u2:User {id: 'user2'}), 
   (m1:Movie {id: 'movie1'}),
   (m2:Movie {id: 'movie2'}),
   (m3:Movie {id: 'movie3'}),
   (m4:Movie {id: 'movie4'}),
   (m5:Movie {id: 'movie5'}),
   (m6:Movie {id: 'movie6'}),
   (gD:Genre {name: 'Drama'}),
   (gC:Genre {name: 'Crime'}),
   (gA:Genre {name: 'Action'})
   
   CREATE 
   (u1)-[:WATCHED]->(m1),
   (u1)-[:WATCHED]->(m2),
   (u2)-[:WATCHED]->(m1),
   (m1)-[:BELONGS_TO]->(gD),
   (m2)-[:BELONGS_TO]->(gC),
   (m3)-[:BELONGS_TO]->(gA),
   (m4)-[:BELONGS_TO]->(gD),
   (m5)-[:BELONGS_TO]->(gC),
   (m6)-[:BELONGS_TO]->(gA)
   
   $$) as (V agtype);
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to