Let's say I have this object (which is mapped)
Employee
----------------
ID
FirstName
LastName
Salary
There are a few employees:
1, John, Doe, 4000
2, Maria, Sharapova, 3500
3, John, Johnson, 3000
4, Theo, Huxtable, 4100
I want to get all distinct first names together with all employees who have that name. So I want to get a list like this:
Code:
John - 1, John, Doe, 4000
- 3, John, Johnson, 3000
Maria - 2, Maria, Sharapova, 3500
Theo - 4, Theo, Huxtable, 4100
In other words, I would like to get a collection of First Names, and within each FirstName-object there should be another collection of employees.
I really have no clue which query to write for that. Is this even possible?