Pergunta

I want to get a count of different Designation of Persons from a table. For Eg, 5 managers, 2 HR, 3 coordinates,etc. The below query gives me a total count of entries in UserDesig field. I want to have total count of different designations in the field like 5 for managers and so on. How will I accompalish this using projection queries?

 Template.Criteria.CreateCriteria("User")
                        .SetProjection(
                        Projections.ProjectionList()
                        .Add(Projections.Count("UserDesig"), "UserCount"));
Foi útil?

Solução

try investigating Projections.GroupProperty(...)

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top