
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
일단 오로지 case when 만 썼을때 쿼리입니다.
SELECT order_id,restaurant_name ,day_of_the_week ,delivery_time ,
case when(day_of_the_week='Weekday') AND delivery_time >=25 then 'Late'
when(day_of_the_week='Weekday') AND delivery_time <25 then 'On-time'
when(day_of_the_week='Weekend') AND delivery_time >=30 then 'Late'
when(day_of_the_week='Weekend') AND delivery_time <30 then 'On-time'
end '지연여부'
FROM food_orders
이것을 case when과 if 랑 합쳐서 쓰고싶은데
SELECT order_id,restaurant_name ,day_of_the_week ,delivery_time ,
case when(day_of_the_week='Weekday') AND if(delivery_time >=25, 'On-time','Late')
when(day_of_the_week='Weekend') AND if(delivery_time >=30, 'On-time','Late')
end '지연여부'
FROM food_orders
if를 주면 이렇게 짧게 가능한데 지금 어느 부분에서 문법이 틀렸나요?
밑에 결과 값처럼 하고싶습니다.

작성한 코드 및 에러 메세지
SQL Error [1064] [42000]: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND if(delivery_time >=25, 'On-time','Late')
when(day_of_the_week='Weekend')' at line 2
Error position: line: 1
