Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQL Query help - Select Multiple rows in each single row with multiple columns

user4487805Jul 11 2013 — edited Jul 11 2013

I would like to select multiple rows in each row with multiple columns.

Here's the example-

Table Name: Policy_Details

Policy_no

Client_id

101

X101

102

Y103

101

X105

103

X108

101

X109

102

X205

........
........
.......

Table Name: Client_Details

Client_id

Company_Name

X101

ABC LTD

Y103

XYZ LTD

X105

TEST CO.

X108

PAUL & SONS

X109

TEST2 CO

X205

FIVE CO

........
.........

Output Required:

Policy_no

company_name1

company_name2

company_name 3

company_name4

101

ABC LTD

TEST CO

TEST2 CO

102

XYZ LTD

FIVE CO

....................

Basically, I would like to combine multiple rows into a single row with multiple columns.

In a real scenario there are huge no of records.

Can anyone please suggest how to do this. Is this possible though sql without pl sql?

Thanks

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 8 2013
Added on Jul 11 2013
2 comments
581 views