I am placing LINKS to the Query, the current result and the required result, since the width of the result is wide
This is the full query that I have written:
When I run this, it returns:
But you will see under the column for "Principal_Procedure", that for the same "DOS" and "ARN", there are different "Principal_Procedure".
I need the result to look like this:
where, if the ARN and DOS is the same, the second, third, fourth, fifth and sixth entry for "Principal_Procedure" moves on to the column "Procedure_1" and "Procedure_2" and so forth till procedure_5
NOTE: In the Database, currently no one has more that 6 Procedure Codes, therefore, max it will go to "Procedure_5" since Principal_Procedure is Procedure_0. In the query, for this particular report purpose, I have to go UPTO 20 Procedures, and am just keeping them blank.