February 18, 2011 at 10:05 am
Hi All,
I am trying to find out when a customer delivery date has been changed and find out the difference. I was wondering what to use DATEADD or DATEDIFF please.
Thank you
DATEDIFF(DD,Delivery_Date,changed_Date) and I get the following result
changed date
9
But I need the result to be as the following
changed date
2011-01-03
Thank you
February 18, 2011 at 5:52 pm
Please provide table def and sample data in a ready to use format as described in the first link in my signature. Also please include your expected output based on the sample data you provided.
February 21, 2011 at 12:43 pm
I am only getting the data from one table which is:
orderid (int)
customer (varchar)
Deliverydate (varchar)
ChangedDate (datetime)
I am only getting the data from one table which is:
orderid customer Deliverydate ChangedDate
12345 Bob 2011-01-02 2011-02-02
Thank you
February 21, 2011 at 12:57 pm
Please provide the sample data your result is based on in a ready to use format.
Your expected result and the "sample data" provided so far don't seem to match. Please explain the business logic behind or post valid data.
February 22, 2011 at 5:45 am
LutzM (2/21/2011)
Please provide the sample data your result is based on in a ready to use format.Your expected result and the "sample data" provided so far don't seem to match. Please explain the business logic behind or post valid data.
The expected result is as follows:
orderid customer Deliverydate ChangedDate
12345 Bob 2011-01-02 2011-02-02
I need to find out is there is a way of writing the script instead of using DATEDIFF therefore my outcome would be in a Date format instead of counting the difference of changed dates.
Thank you
February 22, 2011 at 10:31 am
tt-615680 (2/22/2011)
LutzM (2/21/2011)
Please provide the sample data your result is based on in a ready to use format.Your expected result and the "sample data" provided so far don't seem to match. Please explain the business logic behind or post valid data.
The expected result is as follows:
orderid customer Deliverydate ChangedDate
12345 Bob 2011-01-02 2011-02-02
I need to find out is there is a way of writing the script instead of using DATEDIFF therefore my outcome would be in a Date format instead of counting the difference of changed dates.
Thank you
Together with your source table as described in an earlier post
I am only getting the data from one table which is:
orderid customer Deliverydate ChangedDate
12345 Bob 2011-01-02 2011-02-02
I'd simply use a SELECT * FROM one_table.
At least that's what I can read out of your sample data and expected result...
Please rememeber we don't see what you see. Therefore you should help us to understand what you're looking for.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply