• Given the lack of details it is very difficult to offer much assistance here. I don't really understand why you have the subquery at all. I would also recommend that use the newer join styles instead of the old styles. It is much easier to read and less likely to produce accidental cartesian products. Additionally I would suggest to use meaningful aliases instead of just numbering them.

    This query should produce the same thing as the first query you posted. It is however a lot shorter and a lot easier to read.

    SELECT sc.SUBCASE_NUMBER, SUM(otl.DURATION/60) AS TOTAL_DURATION

    FROM SUBCASE sc

    JOIN ONSITE_TIME_LOG otl on sc.SUBCASE_OBJID = otl.SUBC_ONSITE2SUBCASE

    WHERE

    LEFT(sc.SUBCASE_NUMBER, 7) IN

    (

    '2049356',

    '2049462',

    '2057852',

    '2057877',

    '2057897',

    '2057930',

    '2057948',

    '2057963',

    '2057984',

    '2057996',

    '2058015',

    '2058032',

    '2058049',

    '2066771'

    )

    OR sc.SUBCASE_TITLE LIKE '%CITS%Audit%'

    GROUP BY sc.SUBCASE_NUMBER

    ORDER BY sc.SUBCASE_NUMBER

    Now I realize I haven't actually helped with your issue. Are you doing this in Oracle or SQL?

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/