Hi,

I am working on a report where I need to split the rows and update put it on a different column. For e.g.

Policy No DriverName
123 John
123 David
124 Matt
125 Phil
125 Peter

I need to split the data as per the policy number and instead of having driver names in different rows they need to be updated in different columns, So they should look like

Policy No Drivername1 Drivername2
123 John David
124 Matt
125 Phil Peter

Is this possible? Any help would be appreciated.

Combining data from an indefinite number of rows into single rows in not a natural RDB issue and, in fact, is the antithesis of RDB philosophy. That being said: You will need to write a PL/SQL function, retrieve its string output for each distinct Policy No value in the table. Cannot be done with pure SQL.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.