我想在oracle中加入2个SQL查询,但我真的不熟悉它,我的结构似乎对我来说是正确的,但是我有这个SQL错误信息: “[错误] ORA-00933:SQL命令不能正确地结束”oracle,查询加入问题“SQL命令没有正确结束”
所以我有两个疑问: 第一个是:
select
campaign_id, count(*) as "number of emails sent"
from
dg_res_sent
where
dg_end_date > sysdate
group by campaign_id
,第二个是:
select
offer_name,
campaign_id,
offer_category as "link category",
count(*) as "number of clicks"
from
dg_res_click
where
dg_end_date > sysdate
and
SUBSTR(offer_name,1,3) = 'SKU'
group by
offer_name,
campaign_id,
offer_category
我想做我的加入在CAMPAIGN_ID所以我做:
select
offer_name,
campaign_id,
offer_category as "link category",
count(*) as "number of clicks",
sent.nb_sent
from
dg_res_click
where
dg_end_date > sysdate
and
SUBSTR(offer_name,1,3) = 'SKU'
inner join
(select
campaign_id, count(*) as "nb_sent"
from
dg_res_sent
where
dg_end_date > sysdate
group by campaign_id) sent
on
sent.campaign_id = dg_res_click.campaign_id
group by
offer_name,
campaign_id,
offer_category
任何想法,为什么我得到这个消息:
[ERR] ORA-00933:SQL命令不能正确地结束
不应该在where子句之前放置内连接吗? – Ehsan
我删除了MySQL和SQL Server标记,因为这个问题是关于Oracle的。 –