I am using neptune graph database. Need help writing a query with a group by clause.
We have three nodes
CAMPAIGN → AD → LP
Campaign to Ad is 1 to many mapping AD to LP is 1 to 1 mapping
Suppose we have the following vertices and associations
C1 → A1 → LP1
C1 → A2 → LP1
C2 → A3 → LP1
C2 → A4 → LP1
C3 → A5 → LP2
I want my result set to look like this.
[
{
"lp": "LP1",
"campaigns": [
{aId: "A1", cId: "C1"},
{aId: "A2", cId: "C1"},
{aId: "A3", cId: "C2"},
{aId: "A4", cId: "C2"}
]
},
{
"lp": "LP2",
"campaigns": [
{aId: "A5", cId: "C3"}
]
}
]
Any help would be greatly appreciated.