Suppose I have this table:
name|match
a |*
b |?
c |THIS
d |THAT
Given a value via a replaceable parameter (?), I would like to select the rows where that value is matched by the glob pattern in match.
Examples:
- Given
?==THISexpect the query to return rowsaandc. - Given
?==SELFexpect the query to return rowa. - Given
?==Aexpect the query to return rowsa, andb.
This does not work:
SELECT name from table WHERE match GLOB ?
My feeling is the way to achieve the desired behaviour is query without GLOB and then manually perform the glob in the code calling the query.
>Solution :
You have the operands backwards.
SELECT `name` FROM `table` WHERE ? GLOB `match`