Aging Query

  • kramaswamy,

    Thanks for your suggestion, but i need to stick to TSQL . will try to work around that query

    Regards,

    Ravi

  • OK, I'm sorry, Lynn. I see where you're coming from. I interpreted your statement differently. My apologies.

    Michelle :blush:

  • Attached you will find some code that hopefully meets your needs. I have tested against your sample data, and it seems to work. I haven't had time to work on other possible cases that may occur, so this may not completely meet your needs. It partly depends on wether or not you provided ALL the requirements and test cases that may occur.

    Several other things to note about the code. One, the clustered index I created IS NECESSARY for this to work. Second, please note how I have provided everything in the code you need to test the code. this is what you should do when asking for help. Where possible, you should simply post it directly to your post (unless extremely long) using IFCode code blocks. I'm not here as I have issues at times when doing it from work, which is why it is posted as an attachment.

  • mm (8/19/2009)


    OK, I'm sorry, Lynn. I see where you're coming from. I interpreted your statement differently. My apologies.

    Michelle :blush:

    No problem. Guess I need to get out the halo polish and shine it up a bit. 😉

  • Thanks Lynn,

    Query works if i have 1 negative value in that list for the Particluar Item,City, Street like

    Date: 07/07/2009, Item : A City : NY , Street : ABC , Qty = -4

    But i didnt work when i hve more that 1 negative values like

    Date: 07/07/2009, Item : A City : NY , Street : ABC , Qty = -4

    Date: 05/06/2009, Item : A City : NY , Street : ABC , Qty = -1

    I am still trying to work around that

    Any inputs from any one will be helpful

    Regards,

    Ravi

  • Ravi (8/24/2009)


    Thanks Lynn,

    Query works if i have 1 negative value in that list for the Particluar Item,City, Street like

    Date: 07/07/2009, Item : A City : NY , Street : ABC , Qty = -4

    But i didnt work when i hve more that 1 negative values like

    Date: 07/07/2009, Item : A City : NY , Street : ABC , Qty = -4

    Date: 05/06/2009, Item : A City : NY , Street : ABC , Qty = -1

    I am still trying to work around that

    Any inputs from any one will be helpful

    Regards,

    Ravi

    If you reread my original post with my code you will see that is exactly what i told yu, it works with your sample data but there are problems.

    Your original description of the problem and your sample data failed to provide for this particular situation. I'm not sure how you want that handled, so I didn't know what I should account for in that case.

    When posting problems like this, you really need to provide AS MUCH detail as possible, your sample data should account for the various possibilities that could occur, and your expected results should show how to handle each situation. In the end, what you provided is much like what most users tend to provide. Makes it hard to provide solutions that actually meet your full requirements.

    Unfortunately, I haven't had time to even look at the code since I posted it, and looking at your recent post, I would not know what I need to do to handle the situation.

  • Lynn thanks for your feedback, form next time i will make sure i put all the problems /req. in the first post.

    i have attached the same query that u gave but added 1 record to insert . if you run that query you will come to know what i mean to say in my last post.

    Lynn once again thanks for your help

    Regards,

    Ravi

  • Ravi (8/24/2009)


    Lynn thanks for your feedback, form next time i will make sure i put all the problems /req. in the first post.

    i have attached the same query that u gave but added 1 record to insert . if you run that query you will come to know what i mean to say in my last post.

    Lynn once again thanks for your help

    Regards,

    Ravi

    The problem is if you have more to deduct (negative values) then is available (positive values), I know. What I still don't know is how you want that handled.

  • Ravi, a lot of what you're asking, you really should be doing yourself. I mean really, the main purpose of posting here should be to get ideas on how you can accomplish your tasks, not have the tasks done for you.

Viewing 9 posts - 31 through 38 (of 38 total)

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