Search code examples
memgraphdb

How can I count distinct elements with Memgraph?


I was wondering if Memgraph supports something like COUNT(DISTINCT x) and if not how can I achieve what I'm looking for?


Solution

  • Since Memgraph 2.5.0 there is no longer need for constructions like WITH DISTINCT n.prop as distinct_prop RETURN COUNT(distinct_prop). You can use RETURN COUNT(DISTINCT n.prop) instead.