Jay napisaÅ(a):
WHERE 1
What is this supposed to do? It's not a boolean expression.
AFAIK it would render the same result as 1=1 (it seems that it casts to
boolean true), at least that behaviour was observed in MySQL. Nevermind,
1=1 or any other expression returning true for every row is sufficient
for this query - this is just a placeholder when no search criteria is
specified by the user (the query is dynamically generated).
Did you try:
ORDER BY coalesce(cd1.country_name, cd2.country_name)
in place of:
ORDER BY country_name
Yes - it does help, thanks for suggestion, however - it would certainly
be better if I could keep the ORDER BY / HAVING clauses expression-free
(i.e. with only the field names).
Is there any other way I could:
a) avoid using expressions in ORDER BY / HAVING clauses
b) leave the aliased field name unchanged - for compatibility (e. g. I
have other SQL statements for fallback lang. substitution disabled and I
simply refer to country_description.country_name field in them - so that
I have the same field names in query results).
I don't have any idea - maybe aliased field names share some kind of
"namespace" I could refer them by in ORDER BY clauses like
'_aliased.country_name' ?
Thanks for your help in advance.
With regards,
--
Krzysztof Kotowicz