• realvilla (6/19/2013)


    I so appreciate your help and you have already gone way above and beyond the call of duty. I'll try the left joins and guy more experienced in SQL should be here after lunch. I have seen the "promised land" so I am not giving up.

    To go from 3 hours to a few seconds was so amazing that the co-worker who will be using this still may not be totally convinced. It will be difficult to test each piece of your code but I still think we're close.

    At this point I will just notify you of the progress since your work is done. Like you said, you got me close and the rest is up to us. Thanks again.

    You are quite welcome. It is amazing what a difference it makes when you don't loop and just deal your data as a set. I hope you figure it out and please post back and let me know what happens. It is nice to hear when things like this work out. 😀

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/