SELECT distinct
CM_NAME,
Booking_Date,
sum(DogRevenue) as TTL_DogREV,
sum(Room_Revenue) as TTL_ROOM,
sum(Car_Revenue) AS TTL_CAR,
sum(Activity_Revenue) as TTL_ACT,
0 as TTL_CRUISE,
sum(Dog_Rev + Room + Car + Activity) as
TTL_BOOK
from
(SELECT
internalagentname as CM_NAME,
resvCode AS Booking_Number,
transactionDate AS "Transaction_Date",
CONVERT(VARCHAR(10), initialbookingdate, 101) as Booking_Date
由于某种原因,我在尝试将预订日期转换为MM / DD / YYYY时仍然出现错误,因为它目前采用以下格式:DD-MON-YYYY(01-FEB-2018)
我不断表达缺失错误
答案 0 :(得分:0)
在转换为varchar(10)之前先转换为日期,如下所示:
选择转换(varchar(10),强制转换(' 01-FEB-2018'作为日期),101)