Hi,
In the following query I'm getting the correct result for device and count
but for *total* I'm getting the sum of duplicate relations also, but I want
to avoid the sum of duplicates, I only want the sum of unique relations.
Please help me to correct the query.

MATCH
(genre:Genre)-[:HAS_CHANNEL]->(channel:Channel)-[:HAS_PROGRAM]->(program:Program)-[:HAS_GENDER]->(gender:Gender)-[discoveryByDevice:HAS_PROGRAM_DISCOVERY_BY_DEVICE]->(programDiscoveryByDevice:ProgramDiscoveryByDevice)

WITH DISTINCT channel.name AS channelName, channel.date AS date,
programDiscoveryByDevice.device AS device, discoveryByDevice.count AS
count, sum(discoveryByDevice.count) AS *total *
WHERE channelName IN ["chowtime on","music","bollywood on","hollywood
on","primetime on"]
AND (date >= "2013-11-08" AND date <= "2014-11-08")
RETURN device, sum(count) AS count, sum(total) AS *total*;

 +-----------------------------------------+
 | device         | count | *total*    |
 +-----------------------------------------+
 | "ANDROID" | 2        | 14784 |
 +-----------------------------------------+
 1 row
 488 ms

-Sukaant Chaudhary
<http://in.linkedin.com/pub/sukaant-chaudhary/33/ba8/479>

-- 
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