I have this select statement working fine:
SELECT
pre, dict.char, post, score
, (SELECT @res := MatchPre(pre, 'test') AS var) AS mpre
FROM dict;
It returns all of the data properly, with the result from MatchPre in a column labeled "mpre". However, I want to only get results where mpre > 0. So, logically, I tried this:
SELECT
pre, dict.char, post, score
, (SELECT @res := MatchPre(pre, 'test') AS var) AS mpre
FROM dict
WHERE mpre > 0;
But to no avail. I've tried swapping "WHERE mpre > 0" with "WHERE @res > 0", "WHERE @res.mpre > 0", "WHERE mpre.@res > 0", etc, but it either throws an error or returns an empty result set despite the original where-less query giving rows with mpre values greater than 0.
What is the correct syntax for this?