3
I am 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’d like to select clients with the largest 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... on the chart appears 2 times the same client ( Silva ) where the correct would appear only 1 time with the total of 3 Nights. Can someone help me?
Add a SUM in Booking.Numeronights!
– Marconi
I already added it and it didn’t work
– John