以下是我的查询。
alter Proc Rp_ByVehicleNo
@Vehicle_Number nvarchar(50),
@DateFrom datetime,
@DateTo datetime
as
select Vehicle_Number,Vehicle_Booking_Date,Time_From,Time_To,KM_Start,KM_End,
Total,
SUM(Total) as tot, Vehicle_Used_By,Cost_Code
from mtblLog_Book
where Vehicle_Number=@Vehicle_Number and
Vehicle_Booking_Date between @DateFrom and @DateTo
order BY Vehicle_Booking_Date
显示错误
列“mtblLog_Book.Vehicle_Number”在选择列表中无效,因为它不包含在聚合函数或 GROUP BY 子句中。