delivery changed date query

  • 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

  • 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.



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • 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

  • 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.



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • 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

  • 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.



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply