troubleshooting Question

MySQL query goes wrong

Avatar of Steynsk
SteynskFlag for Netherlands asked on
DatabasesPHPMySQL Server
2 Comments1 Solution458 ViewsLast Modified:
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
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros