How do I check status in where clause?
SELECT `id`,`name`,`start_date`,`end_date`,
CASE
WHEN SYSDATE() < `start_date` THEN 'WAITING'
WHEN SYSDATE() >= `start_date` AND SYSDATE() <= `end_date` THEN 'START'
WHEN SYSDATE() >= `end_date` THEN 'END'
END `status`
FROM teams WHERE `status` = 'START';
When I execute this Query they generate an error like this

See database screenshot also

The problem is that you can’t reference your computed column by name in the same query. So you need to use an inner sub-query:
Or you can duplicate the logic in your
WHEREclause, but most people prefer not to do that. Also note that this solution allows you to simply change yourWHEREclause to get the other result sets:WHERE status = 'WAITING'WHERE status = 'END'You don’t have to mess around with the logic after it’s set up this way.