I would like to join 2 SQL queries in oracle, but I'm really not familiar with it, my structure seems correct to me, but I have this SQL error message: "[Err] ORA-00933: SQL command not properly ended"
So I have two queries: the first one is:
select
campaign_id, count(*) as "number of emails sent"
from
dg_res_sent
where
dg_end_date > sysdate
group by campaign_id
and the second one is:
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
I want to do my join on campaign_id so I did:
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
any idea why I get this message:
[Err] ORA-00933: SQL command not properly ended