• faulknerwilliam2 (12/1/2015)


    Hello

    I have a simple script that brings through, for a certain product, the date it was ordered and the date the order was completed.

    On a graph, I am tring to show the number ordered between a certain date and the number completed between the same date.

    The problem I face is that in the script I have used:

    AND job.orderdate BETWEEN (@odate1) AND (odate2)

    This is absolutely fine for displaying new orders. However, when I use the same parameter for completed orders, it obviously only shows the jobs that were completed between the above parameter.

    For example, if I put in November's date parameters, it will show me:

    50 orders

    25 jobs completed

    What it will not show me is if a job completed in November where the order did not begin in November. So I may have an instance where 15 other jobs were completed in November, but because their start date was say October, they will not come through.

    Can anyone suggest a way of bringing this data through? All I am trying to do is present a graph that shows: new orders and completed orders.

    Thanks

    Do you have a completeddate column anywhere? You'll need to change your script to include that somehow to bring through jobs that were completed in the range.


    On two occasions I have been asked, "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" ... I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
    —Charles Babbage, Passages from the Life of a Philosopher

    How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537