Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- https://platform.stratascratch.com/coding/10285-acceptance-rate-by-date
- with sent as (
- select
- date as datesent,
- user_id_sender||user_id_receiver as requestid
- from fb_friend_requests
- where action='sent'
- order by 1 asc),
- accepted as (
- select
- date as dateaccepted,
- user_id_sender||user_id_receiver as requestid
- from fb_friend_requests
- where action='accepted'
- order by 1 asc
- )
- select datesent as date,
- count(dateaccepted)::FLOAT / count(datesent)::FLOAT as percentage_acceptance
- from sent s
- left join accepted a
- on s.requestid = a.requestid
- group by 1
- order by 1 asc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement