cancel
Showing results for 
Search instead for 
Did you mean: 

Simple Count aggregation on CAP's CQL

acmebcn
Participant

Hi,

I'm trying to build a simple select. It would be something like this:

select <one_field, count(<one_field>) from aTable group by <one_field>

Quite simple, huh? But unfortunately it looks like count, sum, max and so on are not supported in CQL. Or maybe I wasn't able to find a way to do it.

Will I have to do all the calculations in the events? Or there is a way to ask Hana to do the "hard job" (not a big deal for Hana, anyway)?

Thanks in advance for your help,

David R.

Accepted Solutions (1)

Accepted Solutions (1)

olena_
Participant

Hi David,

Thank you for the example here, now I understand the source of the misunderstanding. I was using CQL in a custom handler, not in the view definition. I tried the following and it works for me:

entity ITContact {
        key ID: Integer;
       ...
    }
entity ItTest as select from ITContact {ID, count(ID) as count: Integer} 
group by ID;

Could you please try it out and let me know if this solves your problem?

Best regards,

Olena

acmebcn
Participant

All right, it was exactly what I was looking for. Let me know your favourite bar/pub in town, please, a round of beers is on me! 😉

Have a nice day,

David R.

Answers (0)