. 1point3acres
;with scope
as
(
select
'both' as channel,
customer_id,
date,
sum(spend) as Sum_2,
iif(count(channel)<2,0,count(channel)) as tot_channel
from dbo.spend
group by customer_id,
date
),Isolate
as(
select
date,
channel,
max(iif(tot_channel <2,0, sum_2)) as tot_spend,
max(tot_channel) as count1-baidu 1point3acres
from scope
group by date, channel. 1point3acres.com
. 1point 3 acres
),FINAL
as(.--
select * from isolate. check 1point3acres for more.
union. check 1point3acres for more.
select
date,
channel,
sum(spend) as tot_spend,
count(customer_id) as count1. ----
from dbo.spend-baidu 1point3acres
group by date, channel,customer_id
)
select .google и
*
from FINAL. ----
order by date, case when channel ='both' then'9'
when channel = 'mobile' then '1'
when channel = 'destop' then '2'
end ASC
Q2 in Mysql. 1point3acres.com
. 1point3acres
CREATE VIEW career AS-baidu 1point3acres
SELECT member_id, group_concat(company_name ORDER BY year_start SEPARATOR '-') AS member_career
FROM job
GROUP BY member_id;. 1point 3 acres
# 1)
SELECT count(*)
FROM career
WHERE member_career LIKE '%Microsoft%Google%';
# 2)
SELECT count(*)
FROM career
WHERE member_career LIKE '%MicrosoftGoogle%';