[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Comparing an alias ...


Julio Faerman writes:

> Hi ... I am need the following query to work :
> SELECT
>     min(my_colum) as MINIMAL_VALUE
> WHERE
>     MINIMAL_VALUE > 10
> 
> The query is not EXACTLY as this one, but i think it is enough to get you
> the idea of my problem...

What would this mean? The WHERE clause is what determines what rows
will be used in the GROUP BY functions, e.g. MIN(). How do you know
what rows to use when you need to know what rows to use before you
can figure out the criteria for what rows to use?
Trying to express in words what you wish to accomplish, I'd say that
you want the smallest of all my_column such that this value is greater
than ten. This would be equivalent to WHERE my_column > 10, but if
that's what you want I suppose you wouldn't be asking.

Someone suggested HAVING, but as far as I can see using HAVING to
accomplish MIN(column)>constant is equivalent to WHERE column>constant.

//C - not wearing his glasses

-- 
 Carl Troein - Círdan / Istari-PixelMagic - UIN 16353280
 carl@xxxxxxxxxx | http://pixelmagic.dyndns.org/~cirdan/
 Amiga user since '89, and damned proud of it too.


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <mysql-thread92825@xxxxxxxxxxxxxxx>
To unsubscribe, e-mail <mysql-unsubscribe-treed=ultraviolet.org@xxxxxxxxxxxxxxx>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



This mailing list archive is a service of Copilot Consulting.