Coming up with a subject was a struggle and maybe that indicates an
impossibility. Searching the archive was equally fruitless.

What I am trying to do is to build a SELECT with a compound WHERE  using
one or more run-time parameters. Sort of like transforming an input phrase
such as:
"string1+string2+string3..."
INTO
WHERE
[Value] LIKE '%string1%'
AND
[Value] LIKE '%string2%'
AND
[Value] LIKE '%string3%'
AND...

This brute force method works:
WHERE
[Value] LIKE '%'||$SearchString_ONE||'%'
AND
[Value] LIKE '%'||$SearchString_TWO||'%'
...
but requires every parameter to be acted on (filled in or made blank).

I can build a statement that produces a desirable looking expression but
cannot evaluate it as such with WHERE:

SELECT '[Value] LIKE '||'''%'||REPLACE($SearchString, '+', '%'''||' AND
[Value] LIKE '||'''%')||'%'''
produces
[Value] LIKE '%string1%' AND [Value] LIKE '%string2%' AND [Value] LIKE
'%string3%'

but

WHERE (above SELECT...) evaluates to FALSE

I need a way to convert the text result to an expression that WHERE
evaluates as an expression.

Any possibility to do this within SQLite?

Tom
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to