I have a problem in group by with link to sql
first I have this tables :
- client : Id_client , nom , prenom , villeId
- ville: id_ville , nom
Code:
justiceDataContext dbContext = new justiceDataContext();
GridView1.DataSource = from client in dbContext.Client
join ville in dbContext.Commande
on client.villeId equals ville.Id_ville
group client by ville.nom into g
select new { City = g.Key, NumberOfClients = g.Count() };
GridView1.DataBind();
My objective is to get number of client
by city (ville
)
thank you