Query of Queries error in Coldfusion when using LIKE
May 06, 2007
This very odd behaviour hit me the other day when querying an existing query which was in a scope (i.e request.query):
The query should look like this:
"query" name="getReltrans">
SELECT * from request.translations WHERE ComposerID LIKE '%#somevar#%';
But it throws an error. The reason is, when querying a query object, you need to tell Coldfusion not to return NULL values.
This works:
"query" name="getReltrans">
SELECT * from request.translations WHERE (ComposerID IS NOT NULL AND ComposerID LIKE '%#somevar#%');
Thanks to Ben Nadel for the heads up!
