I have several nodes of the following type: label - ServiceDate, property - date
(:ServiceDate {date: "2018-02-13"} )
I like to write a query that returns the distinct years and number of nodes in each year. The query should return the following:
2016 2017 2018 2019 2020
100 30 200 300 240
the following query gives me the required detail for a particular year :
MATCH (sd:ServiceDate)
WITH date(sd.date) as sd1
WHERE sd1.year = 2018
RETURN count(sd)
I need help on the query that will return for all the years from 2016 to 2020.
appreciate any help.