• Thank you. I almost get there.

    But, if I inserted more values, the duplicate result will displays.

    How to fix it?

    INSERT INTO dbo.PatientInfo

    VALUES ('06000248','08/02/2010','08/04/2010'),

    ('06000248','08/10/2010','08/12/2010'),

    ('06000248','08/20/2010','08/22/2010'),

    ('06000348','08/02/2011','08/04/2011'),

    ('06000348','08/10/2011','08/12/2011'),

    ('06000348','08/20/2011','08/22/2011');

    GO

    MEMBID ADMDATE DSCHDATEDaysOut

    060002482010-08-022010-08-040

    060002482010-08-102010-08-126

    060002482010-08-102010-08-12-359

    060002482010-08-202010-08-228

    060002482010-08-202010-08-22-357

    060003482011-08-022011-08-040

    060003482011-08-102011-08-12371

    060003482011-08-102011-08-126

    060003482011-08-202011-08-22373

    060003482011-08-202011-08-228