Click to See Complete Forum and Search --> : Unknown Column


Shaolin
02-17-2009, 11:35 AM
Hi Guys
See the following code:
SELECT recipient_price_id AS 'id',
recipient_name AS 'name',
recipient_price AS 'price',
recipient_info AS 'info',
NOW() AS 'today'
FROM recipient_price
WHERE today BETWEEN start_date AND end_date AND is_active='1'

Everytime I execute it I get the following error:

Unknown column 'today' in 'where' clause.

mintedjo
02-17-2009, 11:48 AM
You can't do that :-P
Use NOW in the WHERE clause

SELECT recipient_price_id AS 'id',
recipient_name AS 'name',
recipient_price AS 'price',
recipient_info AS 'info',
NOW() AS 'today'
FROM recipient_price
WHERE NOW() BETWEEN start_date AND end_date AND is_active='1'