Hello Team,
I have 3 tables in a Database.
CustomerDetails
ProductDetails
ProductBooking
create table CustomerDetails
(
CustomerID int identity(1,1)
CustomerName varchar(50)
)
create table ProductDetails
(
ProductID int identity(1,1),
ProductName varchar(50),
ProductPrice decimal(18,2)
)
create table ProductBooking
(
BookingID int identity(1,1),
ProductID int,
CustomerID int,
ProductPrice decimal(18,2),
Quantity int,
TotalPrice decimal(18,2)
)
i am running a select Query to get maximum amount of Purchase made by customer and the name of the customer name but is giving me error
select max(PB.TotalPrice),CU.CustomerName from ProductBooking PB,CustomerDetails CU where
CU.CustomerID = PB.CustomerID
it is giving me an error saying CU.CustomerName
Column is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause
Regards,
Raj.Trivedi
Regard's
Raj.Trivedi
"Sharing is Caring"
Please mark as answer if your Query is resolved