• so close...we have a table now, and some expected results....but you provided screenshots of data.

    i cannot copy paste those screenshots into SSMS to get the sample data.

    I'm looking for commands like this, that any of the volunteers can use to get the structure of the table and the data so we can test:

    --The required CREATE TABLE

    CREATE TABLE [dbo].[T_AGGR_MERCHANDISING_WEEK_DIM] (

    [MERCHANDISING_WEEK_DIM_ID] INT NOT NULL,

    [MERCHANDISING_WEEK] CHAR(4) NOT NULL,

    [MERCHANDISING_YEAR] CHAR(4) NOT NULL,

    [MERCHANDISING_WEEK_START_DATE] DATETIME NOT NULL,

    [MERCHANDISING_WEEK_END_DATE] DATETIME NOT NULL,

    CONSTRAINT [PK__T_AGGR_M__BC8A2AD00A537D18] PRIMARY KEY CLUSTERED (MERCHANDISING_WEEK_DIM_ID))

    --SOME fake but representitive of the issue DATA I created.

    INSERT INTO [T_AGGR_MERCHANDISING_WEEK_DIM]([MERCHANDISING_WEEK],[MERCHANDISING_YEAR],[MERCHANDISING_WEEK_START_DATE],[MERCHANDISING_WEEK_END_DATE])

    SELECT 1,'WK1','2009','2009-01-01 00:00:00.000' UNION ALL

    SELECT 2,'WK2','2009','2009-01-04 00:00:00.000' UNION ALL

    SELECT 2,'WK2','2009','2009-01-11 00:00:00.000'

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!