• If that one goes not so bad then incorporate it into the bigger one:

    SELECT DT.date, (a.source + '-' + a.report_item) as report_item,

    SUM(CASE WHEN b.lang = 'EN' THEN CASE a.report_item WHEN 'Test' THEN Test WHEN 'Test2' THEN Test2 ELSE 0 END ELSE 0 END) EN,

    SUM(CASE WHEN b.lang = 'BM' THEN CASE a.report_item WHEN 'Test' THEN Test WHEN 'Test2' THEN Test2 ELSE 0 END ELSE 0 END) BM

    FROM ReportItem a

    INNER JOIN (

    SELECT dateadd(dd,0, datediff(dd,0,b.start_time)) as [date], b.source, b.lang, SUM(b.sel_test) Test, SUM(b.sel_test2) Test2

    FROM TechDetails b

    WHERE b.start_time >= @StartDate

    AND b.start_time < dateadd(dd,0, datediff(dd,0,@EndDate)+1)

    AND b.lang IN ('EN', 'BM')

    GROUP BY dateadd (dd, 0, datediff(dd, 0, b.start_time)), b.source, b.lang

    ) DT ON a.source = b.source

    WHERE a.report_id =8 AND a.flow_name = @flow_name

    AND a.report_item IN ('Test', 'Test2')

    And from looking at the overall design I can conclude the clustered index on ReportItem must be

    (report_id, flow_name, report_item) INCLUDE (source)

    _____________
    Code for TallyGenerator