I'm having problems with the following query:
SELECT Cliente.Nome, (Reserva.NumeroNoites) TotalNoites
From Reserva
inner join Cliente on Reserva.ID_Cliente = Cliente.ID_Cliente
group by Reserva.NumeroNoites, Cliente.Nome
I would like to select clients with the highest number of nights ... However when doing my query ... the result is
Cliente Barbosa : 1 noite; Cliente Silva: 1 noite; Cliente Silva: 2 noites;
Here is the problem ... in the graphic appears 2 times the same client (Silva) in which the correct would appear only once with the total of 3 Nights. Can someone help me?