I have to get those user records whose birthday is uqual to given date. Since the date format of birthday is "Y-d-m" in my database, first I need to convert it to "d-m" format. After that select this field. I use the query something like:
SELECT *, DATE_FORMAT(birthday, '%d-%m') AS birthday_date
FROM users
WHERE birthday_date = '03-06'
but it returns unknown column error:
Unknown column 'birthday_date' in 'where clause'
So how can I solve this problem?
Thanks in advance.
You need to use having 🙂
or