Link to home
Start Free TrialLog in
Avatar of Steynsk
SteynskFlag for Netherlands

asked on

MySQL query goes wrong

Hi Experts,

I've got this query:

SELECT id, date(date_format(datum, '%Y-%m-%d')) as dag FROM programmering

It works excelently but when I try to add a condition:

SELECT id, date(date_format(datum, '%Y-%m-%d')) as dag FROM programmering WHERE dag = '2012-05-26'

I get this error:

#1054 - Unknown column 'dag' in 'where clause'

strange because the row dag exists in the first version of this query but I can't use it in a condition?

All help is appreciated
ASKER CERTIFIED SOLUTION
Avatar of johanntagle
johanntagle
Flag of Philippines image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Steynsk

ASKER

Thank you johanntagle