--- Krzysztof Kotowicz <[EMAIL PROTECTED]> wrote:

> >>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).

Ah :)

> 
> >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).

Oracle does the same thing. I'm not sure what the reason is.


> 
> 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' ?

There is no way I know of to avoid doing this.
I couldn't find one in Oracle either.
You can refer to them by their number:

Select a, b, c
 FROM t
Order by 1

is the same as:

Select a, b, c
 FROM t
Order by a







=====

---------------------------------

"Lord Tarlington gazed upon the crazed Egyptian hieroglyphics on the walls of 
the ancient tomb of the petrified pharaoh, he vowed there would be no curse on 
him like on that other Lord, unless you count his marriage to Lady Tarlington 
who, when the lost treasure was found, will be dumped faster than that basket 
in the bulrushes."
  Melissa Rhodes
---------------------------------

The Castles of Dereth Calendar: a tour of the art and architecture of Asheron's 
Call
http://www.lulu.com/content/77264


                
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Helps protect you from nasty viruses. 
http://promotions.yahoo.com/new_mail

Reply via email to