title: Mysql DATE_ADD INTERVAL with mysql table fields
body: <p>I have one table called datas in there I have <code>id</code>,<code>start_date</code>,<code>end_date</code>,<code>day_count</code>,<code>day_type</code>.<br>
  Where <code>id</code> is primary key,start and <code>end_date</code> is datetime, <code>day_count</code> is int and <code>day_type</code> 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.</p>
  
  <p>Now I want to user this count and type in date_add mysql built-in function.</p>
  
  <p>I have tried to pass it as below but its show error.</p>
  
  <pre><code>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
  </code></pre>
  
  <p>Erro is 
  <code>
  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
  </code>
  Please little hint would be great.</p>