0
下面是我的查詢。因爲它不是在聚合函數或GROUP BY子句包含列在選擇列表中無效,因爲它不包含在聚合函數中
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 [email protected]_Number and
Vehicle_Booking_Date between @DateFrom and @DateTo
order BY Vehicle_Booking_Date
表示錯誤
列「mtblLog_Book.Vehicle_Number」是在選擇列表中無效。