Page 1 of 1

Using Aliases and Fulltext

Posted: Wed Nov 23, 2005 4:17 pm
by seodevhead
I have a column in a table called 'names'

A Fulltext index was created in the CREATE table definition with FULLTEXT (names)

My SELECT query is like so:

Code: Select all

"SELECT names AS n FROM table WHERE MATCH(n) AGAINST('my keywords')";
Can I do this??? Can I use a column's alias in a fulltext WHERE clause??? Thanks.

Posted: Wed Nov 23, 2005 4:20 pm
by hawleyjr
Yes, you should be able to do it. Is it not working?

Posted: Wed Nov 23, 2005 4:22 pm
by seodevhead
No, it's not working :(

Here is the error:

Code: Select all

MySQL Error: Unknown column 'n' in 'where clause'

Posted: Thu Nov 24, 2005 10:55 am
by twigletmac
From http://dev.mysql.com/select:
MySQL Manual wrote: It is not allowable to use a column alias in a WHERE clause, because the column value might not yet be determined when the WHERE clause is executed.
So, you just need to use the full column name in the WHERE clause :)

Mac