Here's my query and below that is returned data
MATCH (n:citations)-[:WROTE_BY]->(a:authors) with n,a,count(a.name) as c where a.name IS NOT NULL RETURN a.name,n.year order by a.name;
| "Victor Mitrana" | 1993 |
| "Victor Mitrana" | 1996 |
| "Victor Mitrana" | 1998
I need to calculate 1998-1993 , bascially max(year) - min ( year ) for each author and display author and longest publication year for each author. Not sure how to achieve it.
This query does the trick (note : I tried on the movie database, just replace Person and Movie by Author and citation as you need)
WITH p, max(m.released) as max, min(m.released) as min
RETURN p, max-min+1 as yearsActive
ORDER BY p.name
Thank you so much that trick certainly worked. Now I can see author with longest career.
WITH a, max(p.year) as max, min(p.year) as min
RETURN a.name, max-min+1 as yearsActive
ORDER BY yearsActive