• Again:

    1) CREATE TABLE statements for your table(s).

    2) INSERT statements with sample data, enough to cover all relevant cases.

    3) The desired result given the sample.

    I will be travelling tomorrow, so if you post something to work from, I hope that someone else can step in.

    [font="Times New Roman"]Erland Sommarskog, SQL Server MVP, www.sommarskog.se[/font]