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 Answer