[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Columns alias ?
Siim Einfeldt aka Itpunk wrote:
>
> > > > > I haven`t read the book, but I`m almost certain that this is
> > > > >untrue. Aliases work fine for me.
> > > >
> > > > Table aliases work fine. Do you have an example that doesn't provoke
> > > > an error with a column alias?
> > >
> > > does this give you an error? SELECT something some FROM table order by
> > > some;
> >
> > There is no WHERE clause is your example.
>
> I must apologies here. I didn`t get the point at first, I thought you
> were talking about alias problems with ORDER BY. Yes, with WHERE clause
> you actually can`t use the aliases. However, there`s another way to do
> it. You could use HAVING instead of WHERE, eg. SELECT something as some
> FROM yourtable HAVING some='somethingelse'; This thing actually works,
> however, when using something like this, here`s bold text from the
> manual: Don't use HAVING for items that should be in the WHERE clause. But
> all in one, you decide. I think I would definately use HAVING here unless
> someone can explain me in detail, why not?
>
>
WHERE restricts what goes into the output table. This output is then
sorted according to
ORDER BY.
HAVING filters the output of the WHERE clause.
You may run out of memory or disk space for temporary files if you use
HAVING instead of WHERE.
Since the whole table or join needs to be filtered, it is much slower.
What is your choice now?
--
---------------------------------------------------------------------
Please check "http://www.mysql.com/documentation/manual.php" before
posting. To request this thread, e-mail mysql-thread60385@xxxxxxxxxxxxxxx
To unsubscribe, send a message to:
<mysql-unsubscribe-treed=ultraviolet.org@xxxxxxxxxxxxxxx>
If you have a broken mail client that cannot send a message to
the above address (Microsoft Outlook), you can use:
http://lists.mysql.com/php/unsubscribe.php
This mailing list archive is a service of Copilot Consulting.