I have been plugging away at this and I am really at a loss for what I'm messing up. I am using My SQL workbench and sending queries to a mariadb. The original function I am working with, returns records just fine, however they pull in all of them (of which there are 1000+). Ideally the function would only return new records instead of all of them (hence no delete). I am trying to use WHERE NOT EXISTS
however SQL is returning error code 1064. Sample code below:
SELECT WHERE NOT EXISTS
usr1.email
, case when ccm.course = 7 then 'CourseComplete'
when ccm.course = 10 then 'Course1' when ccm.course = 4 then 'Course1CourseComplete' else 'other' end as coursecompleted
, course
, date_add(from_unixtime(timecompleted), INTERVAL 1 HOUR) as CompletionDate
FROM moodledb.m_course_completions ccm
inner join m_user usr1
on ccm.userid = usr1.id
where timecompleted is not null and ccm.course in (4,7,10) order by 4 desc
In addition I've tried alternate placements for the where not exists function, but they all return the same error1064. Would a different operator work better? Can goku defeat this new foe? Any suggestions will be greatly appreciated