I have one table called datas in there I have id,start_date,end_date,day_count,day_type.
Where id is primary key,start and end_date is datetime, day_count is int and day_type is varchar.
Now day_type store DAY,WEEK,MONTH as value when user made request and day field hold number of days like 1 to 60.
Now I want to user this count and type in date_add mysql built-in function.
I have tried to pass it as below but its show error.
SELECT
datas.day_count,
datas.day_type,
MIN( datas.start_date ) AS MinDate,
MAX( datas.end_date ) AS MaxDate,
DATE_ADD(MaxDate,INTERVAL datas.day_count datas.day_type) AS ExactDate,
datas.trade_service_id
FROM datas
Erro is
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 'datas.day_type)) AS ExactDate, datas' at line 13
Please little hint would be great.