0

I am having a peoples data set with students (student=1) and I need to monitor these students on a weekkly basis. How can I filter data for a specific date and then monitor it after 7 days and after 14 days? something like this. Only this part works: (CASE WHEN (student = 1) and (start_date = '2015-04-01 00:00:00') THEN 1 ELSE 0 END) AS date_to_monitor, I think thedate_add` gives mme grieve, as it is complaining about a Boolean type

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;
Anna
  • 444
  • 1
  • 5
  • 23
  • `date_add` takes two parameters... The first doesn't contain an equal sign to name the parameter, which is why it thinks you're trying to run a comparison, which returns a boolean... I'm more curious why the first date is in 2015, and the others are not – OneCricketeer Nov 30 '18 at 06:05
  • just an example, the dates as such don't matter - just how it's done – Anna Nov 30 '18 at 06:32
  • Okay, so will `date_add('2018-11-01 00:00:00' , 7)` give you an error? – OneCricketeer Nov 30 '18 at 06:37

0 Answers0