Calculated field in MySQL

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

 



Hello,

I got the following error message from MySQL:
---
Query failed.

MySQL said:

Unknown column 'AGE' in 'where clause'

query = SELECT *, (Year(Now()) - Year(BDAY)) +
((DAYOFYEAR(Now())-DAYOFYEAR(BDAY))/365) as AGE FROM Katalog WHERE AGE >= 31
AND AGE <= 50 AND IS_MEM_EXP = 0 AND IS_OPEN = 1 ORDER BY INPUT_DATE DESC
---

Now, obviously the column should exist, since I am creating it in the query,
but I do not seem to be able to find the bug.

If I would have used Access, I would have created a query inside the
database from my table and SELECT from that, but since I am not I have to
find other ways.

What I would like to do the most, would be to create a field in the table,
which would calculate the field inside the database, but it does not seem to
be possible, though it would save me a lot of trouble every time I need that
column in my application.

Could someone either tell me whats wrong with my query or tell me what I
need to do to make such a calculated field.

Much appreciated.

Morten Twellmann



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux