我无法使此查询生效。目标是在指定日期之间获得strategy_id
(MM_DATE BETWEEN '10-mar-2014' AND '13-mar-2014')
尚未过期
(AND b.END_DATE > '03-apr-2014') and have a Media_cost > 0.
END_DATE
和MM_DATE
位于不同的表格中,Strategy_ID = ID
是共同主题。
SELECT c.MM_DATE
,c.STRATEGY_ID
,c.EXCH_ID
,c.CREATIVE_ID
,c.MEDIA_COST
,b.END_DATE
FROM T1_RPT_PERFORMANCE c
INNER JOIN T1_META_STRATEGY b
ON c.STRATEGY_ID = b."ID"
WHERE c.MM_DATE BETWEEN '10-mar-2014' AND '13-mar-2014'
AND c.EXCH_ID = 18,
AND c.MEDIA_COST > 0,
AND b.END_DATE > '03-apr-2014'
GROUP BY c.STRATEGY_ID;
错误讯息:
ORA-00933: SQL command not properly ended
答案 0 :(得分:4)
删除where子句中的逗号。
明确地在c.EXCH_ID=18 and c.MEDIA_COST > 0
之后。