时间:2021-07-01 10:21:17 帮助过:40人阅读
# yzj邀请昨日数据 SELECT s.id, s.create_at, ch.id, ch.code AS channel, c.id , c.code AS custom, so.id, so.code AS source FROM invite_ship s LEFT JOIN invite_channel ch ON ch.id = s.invite_channel_id LEFT JOIN invite_code_custom c ON c.id = s.code_custom_id LEFT JOIN invite_source so ON s.invite_source_id = so.id WHERE s.invite_source_id != 0 AND s.create_at > date_sub(date_sub(curdate(), INTERVAL 1 DAY), INTERVAL 8 HOUR) AND s.create_at < date_sub(curdate(), INTERVAL 8 HOUR) ORDER BY s.id DESC
此处 s.create_at是时间字段, 如果你库里存的是utc时间 用这条sql逻辑准没错
mysql 获取昨天数据 utc时间
标签:des sql 获取 date() 时间 utc date_sub esc create