Combine multiple rows into single output

  • Comments posted to this topic are about the item Combine multiple rows into single output

    Mohit Nayyar
    "If I am destined to fail, then I do have a purpose in my life, To fail my destiny"

  • Thanks Mohit. This sure saved me some time!

  • Hi,

    I am facing one performance issue.This is the scenario.

    For eg., EmpId,EmpName,DeptId,DeptName,Sal are there.Except sal all the remaining columns values are same(I mean having same data).

    Assume,here 4 rows are there in that table.

    so I wrote a select query to get the data like 1,xx,1,yy,50,500,5000,1000

    here 50,500,5000,1000... are the sal column values.

    I wrote a function to get the sal values as comma separated ones if the remaining column values are same.But for Huge no' of records (assume for 25000 records), the performance is very bad.:crying:

    So need a inbuilt query / any other solution for this problem.

  • For same purpose we can use cussor too.

    Can you specify which idea is better and why ?

    Cursor Or UDF.

  • Ran into the same issue here. This function causes my query to literally be 15 times slower. Going from under 1 second to over 15.

    Haven't found a work around yet.

  • Actually I fixed this problem. I added an index on the table that I used in the function. This sped things right back up.

    Have you tried adding some indexes?

Viewing 6 posts - 1 through 5 (of 5 total)

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