hi i'm using spring data in My project and I'm trying group by two fields, heres the request:
@Query( "SELECT obj from Agence obj GROUP BY obj.secteur.nomSecteur,obj.nomAgence" )
Iterable<Agence> getSecteurAgenceByPc();
it works but the data doesnt grouped by secteur...heres what it gives me:
{
"status": 0,
"data":
[
{
"secteur": "Safi",
"agence": "CTM"
},
{
"secteur": "Safi",
"agence": "Dep"
},
{
"secteur": "Rabat",
"agence": "Agdal"
},
{
"secteur": "Rabat",
"agence": "CTM"
},
{
"secteur": "Essaouira",
"agence": "CTM"
},
{
"secteur": "Essaouira",
"agence": "Gare Routiere Municipale"
}
]
}
the behaviour which i'm looking for is:
-Safi
-CTM
-Dep
-Rabat
-CTM
-Agdal
-Essaouira
-CTM
-Gare Routiere Municipale