• One way is to save my result in temp table and display it but i know there might be some other better way to perform this..

    Use a reporting tool. This sort of formatting is generally performed by the client application, not the database server.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.