Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8424909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:08:01+00:00 2026-06-10T04:08:01+00:00

I have one table called datas in there I have id , start_date ,

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T04:08:02+00:00Added an answer on June 10, 2026 at 4:08 am

    This query works in MySQL but what do you exactly want to output without Group and so on?

    SELECT
    datas.day_count,
    datas.day_type,
    MIN( datas.start_date ) AS MinDate,
    MAX( datas.end_date ) AS MaxDate,
    
    start_date, min(start_date) as min_date,
    case day_type 
      when 'MONTH' then DATE_ADD(MAX( datas.end_date ),INTERVAL datas.day_count MONTH) 
      when 'DAY' then DATE_ADD(MAX( datas.end_date ),INTERVAL datas.day_count DAY) 
    end as ExactDate,
    
    datas.trade_service_id
    FROM datas
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one table called gallery . For each row in gallery there are
I have a table called blocks with a primary key blockid . The data
Lets say I have one table called REVIEWS This table has Reviews that customers
I have one table, t1, which has fileds called userid, week and year fields.
I have a table called sellerparams with a number of columns, one of them
I have 2 datatables in a dataset. One table has a list called CostTypes.
I have a table called People one of the columns is an xml field
I have a table called player and after inserting the data into there, which
I have two tables, one called Events and one called Documents. Each table has
I have a table called SharedNumber , which has only one field - an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.