Syntax issue in SQL CASE using JavaScript

When the term is selected:
image

The query should figure out the dates to filter. Specifically, if it is SUMMER 2019, get only dates from June 2019 through August 2019. For SCHOOL 2020-2021, get September 2020 through May 2021.

Here’s the code I have so far. I don’t like it, but it was working when I use the filters line by line. It’s when I put it into the CASE statement, I start getting errors.

Any ideas on how to make it work? Or what’s wrong with it?

It doesn’t like this version, either:

Hi there @mathfour,

What type of SQL resource is this? There are slight syntactic differences between different flavors, so it is a bit difficult to determine the exact cause of your issue here.