Topic: SQL*Plus and PL/SQL >> Rows as Columns and Vis a vis
|
Disclaimer: The purpose of all dbapool forums including OCP and Other Oracle Certification forums is to help each other with specific issues but not to share dump and copyrighted exam content, materials or intellectual property.
You may review the entire Oracle Certification Program Candidate Agreement online Here.
|
|
|
|
| Title: Rows as Columns and Vis a vis |
| Rajnish |
Posted: Apr 21, 2006 04:35:46 AM |
Total Post: 2
Joined: Apr, 2006
|
Hi,
I have data in a table as follows:
CLIENT REVNO QTY1 RATE1 QTY2 RATE2 QTY3 RATE3
cln1 1 50 120 60 130 70 140
cln1 3 10 100 20 50 30 25
cln1 4 40 50 30 25 40 15
cln1 2 20 120 10 60 20 30
cln1 5 25 70 15 35 30 18
I require output in following format:
For each client,
In each record, qty1 and rate1 for revno=5 should come first then qty2 & rate2 of revno=4 and so on..
cln1 25 70 40 50 10 100 20 120 50 120
cln1 15 35 30 25 20 50 10 60 60 130
cln1 30 18 40 15 30 25 20 30 70 140
for next client,
3 more rows will come.
In the first record of above result "25" is qty1 of revno=5 & "70" is rate1 of revno=5
similarly, "40" is qty1 of revno=4 and "50" is rate of revno=4 and so on ..
In the second record, "15" is qty2 of revno=5 and "35" rate2 of revno=5 and so on.
So basically,
it should be qty1 & rate1 of revno 1through 5 in 1st records then
qty2 & rate2 of revno 1 through 5 in 2nd record
and qty3 &rate3 of revno 1to5 in 3rd record.
Any suggestions.
|
|
|
Subhranil |
| Posted: May 27, 2006 11:22:16 PM | |
|
Total Post: 28
Joined: Jul, 2005
|
We better to create a temporary table fill it up according to your query and then query the temp table.
|
|
|
|
|
| Time Zone: EDT |
Send this thread to your friend |
|
|
|
|
Forum Rules & Description
Who Can Read The Forum? Any registered user or guest
Who Can Post New Topics? Any registered user
Who Can Post Replies? Any registered user
|
| |
Get FREE Magazines
|
Top 10 Forum User
|
| Murtuja Khokhar | 857 |
| Mohammed Taj | 746 |
| positive fanatic | 483 |
| Jayanta Sur | 479 |
| Vigyan Kaushik | 386 |
| Gopu Gopi | 334 |
| Gitesh Trivedi | 322 |
| Vinoth Kumar | 264 |
| neeraj sharma | 258 |
| Ramesh Jois | 246 |
|
|