simplified version of my query
SELECT *
FROM logs
WHERE pw=\'correct\' AND CASE WHEN id<800 THEN success=1 ELSE END
AND YEAR(timestamp)=2011
You can transform logical implication A => B
to NOT A or B
. This is one of the most basic laws of logic. In your case it is something like this:
SELECT *
FROM logs
WHERE pw='correct' AND (id>=800 OR success=1)
AND YEAR(timestamp)=2011
I also transformed NOT id<800
to id>=800
, which is also pretty basic.