• J Livingston SQL (2/7/2016)


    Raxter (2/7/2016)


    I added the DDL statements to create tables. I apologize for not supplying all the needed information. I am new to this site but will make sure in the future any posts have all of the information. I appreciate all the input.

    please provide sample data insert scripts and expected results based on that sample data

    ... and debug your code before posting. Currently it results in an error when I try to run it in an empty database. I can guess what I think the intended code is, but I rather be sure that I solve the right problem.


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/