我正在与学生(学生= 1)建立一个民族数据集,我需要每周对这些学生进行监控。
如何过滤特定日期的数据,然后在7天和14天之后对其进行监视?
这样的事情。
仅此部分有效:(CASE WHEN (student = 1) and (start_date = '2015-04-01 00:00:00') THEN 1 ELSE 0 END) AS date_to_monitor, I think the
date_add`令mme悲伤,因为它抱怨布尔类型
Select *,
(CASE WHEN (student = 1) and (start_date = '2015-04-01 00:00:00') THEN 1 ELSE 0 END) AS date_to_monitor,
(CASE WHEN (student= 1) and (date_add(start_date = '2018-11-01 00:00:00' , 7)) THEN 1 ELSE 0 END) AS date_to_monitor,
(CASE WHEN (student= 1) and (date_add(start_date = '2018-11-01 00:00:00' , 14)) THEN 1 ELSE 0 END) AS date_to_monitor,
from old;