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 8537099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:49:02+00:00 2026-06-11T10:49:02+00:00

sorry, it’s hard to explain my question in one line. Here’s my current query

  • 0

sorry, it’s hard to explain my question in one line.

Here’s my current query in MySQL:

SELECT purch_id AS PURCH_ID, 
DATEDIFF(CURDATE(),(purch_date)) AS PURCH_DATE 
FROM CS260USER.candy_purchase;

So as an example, one of the purch_date entries is 10-28-2004
What I really want to get is actually the difference between that (10-28-2004) and Christmas Day of THIS YEAR, 2012. (Yes, this is for a homework thingy, I’m not really that interested in Christmas Day, but the professor is 😛 )

Okay, so what I tried to do was something like this:

SELECT purch_id AS PURCH_ID, 
DATEDIFF('12-25-2012',(purch_date)) AS PURCH_DATE 
FROM CS260USER.candy_purchase;

But it didn’t like that.

And the full part of the assignment is to code in the ’12-25′ part but then retrieve the current year, so that if you tried this again in 2013 it’d work for 12-15-2013.

Does that make sense? Need to retrieve data that’s in the table, and find the difference between that and Christmas Day of the Current Year.

  • 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-11T10:49:03+00:00Added an answer on June 11, 2026 at 10:49 am
    select datediff(concat(year(now()),'-12-25'), purchase_date)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

sorry for my really dumb question.(I'm so new in this!). I have a query
Sorry about terrible title, not sure of a better one. Here's a gross simplification
Sorry for question but I can't find answer anywhere on internet. I couldn't find
Sorry for this simple question, but I can't solve it... There is an example:
Sorry, I know this question is easy, but I don't know how to get
sorry for the dummy question but I cannot find a simple and clean way
Sorry but I am not sure how to ask this question but I am
Sorry if this question seems stupid, but it's stumped me for a couple days,
Sorry if this is a stupid question, but is there an easy way to
Sorry if my question was unclear. I got a bunch of elements and the

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.