-- select m.* from message m join message_type mt on m.msg_type_id = mt.id -- where m.status = 1 and mt.remind_type_id = 2 and timestampdiff(hour,m.create_at,now())>=48 -- and timestampdiff(hour,m.update_at,now())>=24 and m.push_count < mt.notice_count; select * from message m join message_type mt on m.msg_type_id = mt.id where m.status = 1 and mt.remind_type_id = 3 and ( find_in_set( mt.push_date,concat('w', weekday(now() ) +1) )or find_in_set( mt.push_date,concat('w', day(now() ) +1) ))