I've encountered a problem I can't explain and would be very grateful for any input.
I have the following SQL statement (its not table dependent but demonstrates the problem):
[CASE WHEN 2>1 THEN "Greater" ELSE "Less" END AS Comparison]
This SQL query returns the correct single column named Comparison with one row of value "Greater" as expected with a SQL Browser (using MySQL 5 by the way), but returns nothing when executed using the TQuery component; not even an error from MySQL to say it was unhappy with something.
If I repeat the above using the TParams property with "Greater" in :1 and "Less" in :2 with the following code:
[CASE WHEN 2>1 THEN :1 ELSE :2 END AS Comparison]
it works as it should.
This problem only happens with string values enclosed in quotation marks. If returning values such as
[CASE WHEN 2>1 THEN 1 ELSE 2 END AS Comparison]
it works fine.
I would be grateful to anyone out there who knows why this is happening, and any workarounds if they exist.
Thanks in advance.