I have one table called datas in there, I have a id, start_date, end_date, day_count, day_type.
Where idis the primary key, start and end_dateare the date and time, day_countare int and day_typeare varchar. Now day_type stores DAY, WEEK, MONTH as the value when the user made the request, and the day field holds the number of days, for example, from 1 to 60.
Now I want to use this counter and enter the mysql date_add function.
I tried passing it as shown 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
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 a little hint would be great.
source
share