SELECT distinct
REPLACE(CM_NAME, '/', ' ') as CM_NAME,
TO_CHAR(Booking_Date,'MM/DD/YYYY') AS Booking_Date,
where Booking_Date = (sysdate-1),
sum(Air_Revenue) as TTL_AIRFARE,
sum(Room_Revenue) as TTL_ROOM,
sum(Car_Revenue) AS TTL_CAR,
sum(Activity_Revenue) as TTL_ACTIVITY,
0 as TTL_CRUISE,
sum(Air_Revenue + Room_Revenue + Car_Revenue + Activity_Revenue) as
TTL_BOOKING
所以我试图用这个来选择昨天的日期,但我一直得到一个缺失的表达错误
答案 0 :(得分:0)
SELECT
REPLACE(CM_NAME, '/', ' ') as CM_NAME,
TO_CHAR(Booking_Date,'MM/DD/YYYY') AS Booking_Date,
SUM(Air_Revenue) as TTL_AIRFARE,
SUM(Room_Revenue) as TTL_ROOM,
SUM(Car_Revenue) AS TTL_CAR,
SUM(Activity_Revenue) as TTL_ACTIVITY,
0 as TTL_CRUISE,
SUM(Air_Revenue) +SUM( Room_Revenue) +
SUM(Car_Revenue) + SUM(Activity_Revenue) as TTL_BOOKING
FROM table_name
WHERE Booking_Date = (sysdate-1)
GROUP BY CM_NAME, BOOKING_DATE
我试过这个,用你的实际表名替换table_name。