• To help others who are trying to help you here is how you should post it in the future. Note I changed your DDL to declare a table variable rather than an actual table (a temp table would also be appropriate) because I'd rather not have these tables sticking around if I forget the delete them afterwards. At the very least just make sure to add a DROP TABLE statement at the end.

    DECLARE @ITGDaillyMetrics TABLE (

    ITG varchar (max),

    Backenderror int,

    dates datetime )

    insert into @ITGDaillyMetrics values ('ITG01 - XFINITY Username and Password Reset',10,'26 Sep 2016')

    insert into @ITGDaillyMetrics values ('ITG02 - XFINITY Username and Password Reset',20,'26 Sep 2016')

    insert into @ITGDaillyMetrics values ('ITG03 - XFINITY Username and Password Reset',30,'26 Sep 2016')

    insert into @ITGDaillyMetrics values ('ITG04 - XFINITY Username and Password Reset',40,'26 Sep 2016')

    insert into @ITGDaillyMetrics values ('ITG05 - XFINITY Username and Password Reset',50,'26 Sep 2016')

    insert into @ITGDaillyMetrics values ('ITG01 - XFINITY Username and Password Reset',10,'25 Sep 2016')

    insert into @ITGDaillyMetrics values ('ITG02 - XFINITY Username and Password Reset',20,'25 Sep 2016')

    insert into @ITGDaillyMetrics values ('ITG03 - XFINITY Username and Password Reset',30,'25 Sep 2016')

    insert into @ITGDaillyMetrics values ('ITG04 - XFINITY Username and Password Reset',40,'25 Sep 2016')

    insert into @ITGDaillyMetrics values ('ITG05 - XFINITY Username and Password Reset',50,'25 Sep 2016')

    insert into @ITGDaillyMetrics values ('ITG01 - XFINITY Username and Password Reset',10,'24 Sep 2016')

    insert into @ITGDaillyMetrics values ('ITG02 - XFINITY Username and Password Reset',20,'24 Sep 2016')

    insert into @ITGDaillyMetrics values ('ITG03 - XFINITY Username and Password Reset',30,'24 Sep 2016')

    insert into @ITGDaillyMetrics values ('ITG04 - XFINITY Username and Password Reset',40,'24 Sep 2016')

    insert into @ITGDaillyMetrics values ('ITG05 - XFINITY Username and Password Reset',50,'24 Sep 2016')

    insert into @ITGDaillyMetrics values ('ITG01 - XFINITY Username and Password Reset',10,'23 Sep 2016')

    insert into @ITGDaillyMetrics values ('ITG02 - XFINITY Username and Password Reset',20,'23 Sep 2016')

    insert into @ITGDaillyMetrics values ('ITG03 - XFINITY Username and Password Reset',30,'23 Sep 2016')

    insert into @ITGDaillyMetrics values ('ITG04 - XFINITY Username and Password Reset',40,'23 Sep 2016')

    insert into @ITGDaillyMetrics values ('ITG05 - XFINITY Username and Password Reset',50,'23 Sep 2016')

    SELECT * FROM @ITGDaillyMetrics

    Now based on your requirements I'm a little confused. You want a column called date range but have the dates listed out in a list. I think this is a bad idea. Also in your example you have a variety of backend errors associated with the same 'ITG' but you sample data only has one unique error per ITG. For example ITG01 only ever has error 10 while ITG02 only has error 20. If this is not reflective of how your real data is you should fix it since people will spend time to help you, only to end up being told it's not quite working as you expected. If you only care about a date range than you only need to know about 2 dates and not a list of all dates within that range. If you are looking for errors listed out by date than that is not a good way of going about displaying that information.

    The more information we have the more we can help.

    Cheers,


    SELECT quote FROM brain WHERE original = 1
    0 rows returned