WITH nl_sentcount
AS(
Select nl_id, count(distinct user_id) as sent_num from sheet1$ Where event_type='nlsent' group by nl_id
)
, nl_opencount AS (
SELECT nl_id, count(distinct user_id) as open_num from Sheet1$ where event_type = 'nlpv' group by nl_id
)
select a.nl_id, sent_num, open_num
from nl_sentcount a
inner join nl_opencount b
on a.nl_id = b.nl_id
目前我有上述一段代码,然后结果是这样的
我想问一下如果我想在这个表里在加一列open rate (open_num/sent_num) ,应该怎么修改代码?