Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
seodevhead
Forum Regular
Posts: 705 Joined: Sat Oct 08, 2005 8:18 pm
Location: Windermere, FL
Post
by seodevhead » Wed Nov 23, 2005 4:17 pm
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.
hawleyjr
BeerMod
Posts: 2170 Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA
Post
by hawleyjr » Wed Nov 23, 2005 4:20 pm
Yes, you should be able to do it. Is it not working?
seodevhead
Forum Regular
Posts: 705 Joined: Sat Oct 08, 2005 8:18 pm
Location: Windermere, FL
Post
by seodevhead » Wed Nov 23, 2005 4:22 pm
No, it's not working
Here is the error:
Code: Select all
MySQL Error: Unknown column 'n' in 'where clause'
twigletmac
Her Royal Site Adminness
Posts: 5371 Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK
Post
by twigletmac » Thu Nov 24, 2005 10:55 am
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