MATCH (c:cc {type : 'type'}) WHERE c.email is not null RETURN c.type as personType, 'email' as attribute, c.email as measure , count(c) as attributeCount
UNION
MATCH (c:cc {type : 'type'}) WHERE c.address is not null RETURN c.type as personType, 'address' as attribute, c.address as measure , count(c) as attributeCount
UNION
MATCH (c:cc {type : 'type'}) WHERE c.phone is not null RETURN c.type as personType, 'phone' as attribute, c.phone as measure , count(c) as attributeCount
UNION
MATCH (c:cc {type : 'type'}) WHERE c.social is not null RETURN c.type as personType, 'social' as attribute, c.social as measure , count(c) as attributeCount
UNION
MATCH (c:cc {type : 'type'}) WHERE c.twitter is not null RETURN c.type as personType, 'twitter' as attribute, c.twitter as measure , count(c) as attributeCount
UNION
MATCH (c:cc {type : 'type'}) WHERE c.facebook is not null RETURN c.type as personType, 'facebook' as attribute, c.facebook as measure , count(c) as attributeCount
This will give back something like this.
"type" , 'email' , 1, 34
"type" , 'phone' , 1, 21
But i want that even when some are not found that a row is given back with 0. I would like a list like this
"type" , 'email' , 1, 34
"type" , 'phone' , 1, 21
"type", "address", 0, 0
"type", "social", 0, 0
Many thanks for your possible advise