I have this SQL query:
SELECT childUsers.userName,
(IF(childUsers.modified >= Convert(datetime, '2018-11-15')
BEGIN
CASE
WHEN childUsers.ProgressID = 1 THEN 'New Level One'
WHEN childUsers.ProgressID = 2 THEN 'New Level One Completed'
WHEN childUsers.ProgressID = 3 THEN 'New Level Two'
WHEN childUsers.ProgressID = 4 THEN 'New Level Two Completed'
ELSE 'Has Not Started'
END
ELSE
BEGIN
CASE
WHEN childUsers.ProgressID = 1 THEN 'Introduction'
WHEN childUsers.ProgressID = 2 THEN 'Introduction Completed'
WHEN childUsers.ProgressID = 3 THEN 'Unit 1'
WHEN childUsers.ProgressID = 4 THEN 'Unit 1 Completed'
ELSE 'Has Not Started'
END) as furthestSectionVisited
FROM childUsers
WHERE childUsers.usergroupId=112888
I want to set a conditional IF statement which will check a specific field in the table, if the modified table is older from a specific date then the values returned will need to be different.
In this case I'm getting error, am I missing something or something needs to be modified?