I have multiple json document like this
{
"event": "eb1518fb-81d1-49aa-9854-405267a7828f",
"identityId": "5eb44b44-d5ce-4473-815c-591a4ff1bea3",
"bookingCode": "ABCDE",
"status": "SUCCESS",
"clientId": "DESKTOP",
"created": "2021-04-15T04:16:35+00:00",
"locationType": "STORE"
},
{
"event": "eb1518fb-81d1-49aa-9854-405267a7828f",
"identityId": "5eb44b44-d5ce-4473-815c-591a4ff1bea3",
"bookingCode": "ABCDE",
"status": "FAILURE",
"clientId": "MOBILE",
"created": "2021-04-15T04:16:35+00:00",
"locationType": "STORE"
},
{
"event": "eb1518fb-81d1-49aa-9854-405267a7828f",
"identityId": "q1244b44-d5ce-4473-815c-591a4ff1bea3",
"bookingCode": "BCD",
"status": "SUCCESS",
"clientId": "MOBILE,
"created": "2021-04-15T04:16:35+00:00",
"locationType": "STORE"
},
...
I want to apply group by identity id and booking code to get the unique records and need to get the entire JSON document after filtering, something like this
select *, count(*) from eventbooking where event = "eb1518fb-81d1-49aa-9854-405267a7828f"
group by bookingCode, identityId
This is giving me an error Expression self must depend only on group keys or aggregates
Is there any way that i can get the entire json document after filtering with group by?
I'm expecting an output similar to this.
{
"event": "eb1518fb-81d1-49aa-9854-405267a7828f",
"identityId": "5eb44b44-d5ce-4473-815c-591a4ff1bea3",
"bookingCode": "ABCDE",
"status": "FAILURE",
"clientId": "MOBILE",
"created": "2021-04-15T04:16:35+00:00",
"locationType": "STORE"
},
{
"event": "eb1518fb-81d1-49aa-9854-405267a7828f",
"identityId": "q1244b44-d5ce-4473-815c-591a4ff1bea3",
"bookingCode": "BCD",
"status": "SUCCESS",
"clientId": "MOBILE,
"created": "2021-04-15T04:16:35+00:00",
"locationType": "STORE"
}