Is it possible to include 2 or more COUNT aggregate in the same query/request? I’ve tried it and got no execution error but the result for the second COUNT is not correct. Perhaps I’m doing something else wrong. I’m elaborating my scenario below.
Social Post has 1:N Comment (as comments)
Social Post has 1:1 Picture (as picture)
Picture has 1:N Users (as likes)
- I want to know the total amount of likes and comment on each Social Post retrieved.
- The totalLikes property is populated by the first aggregate.
- The another property stands for the total amount of comments.
- The totalComments property is populated by manually counting on the Comment table (would be replaced with the another property if the aggregate worked).
- When I add the second aggregate, the first one also messes up (totalLikes and another both have the same unknown number).
Counter for totalComments (manually on Comments table)
Result with 1 aggregate (totalLikes only | Both counters are correct)
Result with 2 aggregated (totalLikes and another are incorrect, must be as in image above)
Thanks in advanced