How can I create entities with OQL that use count() in the query?

Currently, my task in a project is to retrieve certain data, get the count and then write this information into a new entity. However I would like to save some time and processing power when doing so.   Let's say we have the Entity Person and Object, and each Person can own a list of objects. My query would look like this ( very simple, just for demonstration sake )   SELECT Person.Name, count(Object.ID) FROM Person JOIN Person/Person_Object/Object GROUP BY Person.Name   I now would like to run this OQL query with the "Execute OQL Query" activity that in turn creates a new entity PersonInfo that contains the name of the Person and the count of the objects. However when I create an entity with those Attributes it throws me an error. I assume it can't write the count into that entity. Is there a way how I could achieve that? I know that I could iterate over each person and get the count of objects separately but I would like to do this in one single query if possible.   The reason I am working with OQL is because I am dealing with millions of entities and the query is way more complex with multiple joins, subqueries and all that.    When using the OQL Snippet in the Module the query runs completely fine and I get the count that I want but I can't figure out how to store this in an entity. Any pointers would be great.
1 answers

Okay, turns out I was overlooking the most obvious mistake


Whenever I tried to give the count a name I gave it the name Count, which is obviously a key word and therefure not usable


SELECT Name, count(*) AS Count ...

This throws an error


If however I write 

SELECT Name, count(*) AS Number ...

it does it correctly and no error is thrown.


So simple mistake on my side, using keywords where they shouldn't be written