select c.user_id uid from user_ad_click_time c join user_payment_time p on c.trace_id = p.trace_id where substr(c.click_time,1,14) = substr(p.pay_time,1,14) and substr(c.click_time,15,2) - substr(p.pay_time,15,2) < 5 and substr(c.click_time,15,2) - substr(p.pay_time,15,2) > -5