Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select
- A.date,
- A.mid,
- B.referral,
- C.couponname
- from
- (select
- distinct m.id as mid,
- date(m.created_at + interval '8' hour) as date
- from members m
- where m.created_at+interval 8 hour >= '2019-05-01 00:00:00') A
- left join
- (select
- distinct ma.member_id as mid,
- ma.recommender as referral
- from member_appendixes ma) B
- on B.mid = A.mid
- left join
- (select
- distinct c.member_id as mid,
- c.comment as couponname
- from coupons c) C
- on C.mid = B.mid
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement