group by with substring

  • Hi

    Fellows

    i have simple statment like

    select lob, substring(Entrprisename 13,9), sum(offered), sum(handled)

    from TableA

    group by lob, substring(Entrprisename 13,9)

    order by lob, substring(Entrprisename 13,9)

    I know the problem is because of including substring( Entrprisename 13,9) in group by,This looks simple but when it comes to large size data, the performance is horrible

    Anybody know workaround

    Thanks

    simon

  • create a computed column for substring(Entrprisename 13,9), and index it...should help speed things up.

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply