Subject | Re: [firebird-support] Firebird 3.0 : Reordering Fields in WHERE Search Condition of Query Returns Different Recordsets |
---|---|
Author | Ivan Přenosil |
Post date | 2013-10-19T10:25:31Z |
> 1. On reordering the fields in WHERE search condition of a query, different sets of records are returned. Relevant details listed...
> in subsequent Paras.
> SELECT a.USERNAME, a.USERPSWD FROM MYUSERS a where upper('%' || a.USERNAME || '%') like upper('%' || a.USERPSWD || '%')...
> SELECT a.USERNAME, a.USERPSWD FROM MYUSERS a where upper('%' || a.USERPSWD || '%') like upper('%' || a.USERNAME || '%')Works as expected.
> xyz xyz
> abc abc
> pqr pqr123
> user user123
LIKE is not symmetric operator - on the left there is *value*, on the right is *pattern*.
Pattern can contain wildcards, which are different from what you may be used to -
"_" means single character
"%" means zero or more characters !!!
Ivan