mysql 里,随便写两个语句嵌套的。

msyql 5.7 社区版。

SELECT
*
from
user_detail ud
WHERE
ud.pk not in (SELECT lwl.uid from lucky_wheel_log lwl WHERE lwl.time > '2018-03-24 00:00:00' AND lwl.time < '2018-04-01 00:00:00');
--

SELECT
lwl.uid as uid
FROM
lucky_wheel_log lwl
WHERE
lwl.time > '2018-03-24 00:00:00' AND lwl.time < '2018-04-01 00:00:00'
AND
lwl.bonus_desc like '%卡%'
AND
lwl.uid not in (SELECT DISTINCT bwr.user_id from bid_winning_record bwr WHERE bwr.bid_time > '2018-03-24 00:00:00' AND bwr.bid_time < '2018-04-01 00:00:00')