Home » SQL & PL/SQL » SQL & PL/SQL » need help Column to rows (oracle 10q)
icon5.gif  need help Column to rows [message #424793] Tue, 06 October 2009 01:19 Go to next message
bmineonly
Messages: 5
Registered: October 2009
Location: karachi
Junior Member

i have a query like
select sum(union.a) Credit, sum(union.b) Debit
from
( query 1,
union all
query 2
union all
query 3) union


when i run this query i get the result
Credit Debit
val of a val of b


and i want the result like

Type Amount
Credit val of a
Debit val of b


Note that the val of a mean the data of union.a field and val of b mean the data of union.b field union is the alias of all unions.

hope u will understand my question
i m waiting for your reply.
thanks a alots with regards Confused
Re: need help Column to rows [message #424796 is a reply to message #424793] Tue, 06 October 2009 01:30 Go to previous messageGo to next message
delna.sexy
Messages: 941
Registered: December 2008
Location: Surat, The Diamond City
Senior Member
These types of questions are asked repeatedly here.
Search the forum for "pivot" or "column to rows".

regards,
Delna
Re: need help Column to rows [message #424798 is a reply to message #424796] Tue, 06 October 2009 01:39 Go to previous messageGo to next message
bmineonly
Messages: 5
Registered: October 2009
Location: karachi
Junior Member

i searched a lots but did not get what i want.
Confused Sad
Re: need help Column to rows [message #424801 is a reply to message #424793] Tue, 06 October 2009 01:42 Go to previous messageGo to next message
Michel Cadot
Messages: 63806
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter), use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version with 4 decimals.

Post a working Test case: create table and insert statements along with the result you want with these data.

Regards
Michel
Re: need help Column to rows [message #424814 is a reply to message #424801] Tue, 06 October 2009 02:10 Go to previous messageGo to next message
bmineonly
Messages: 5
Registered: October 2009
Location: karachi
Junior Member

i m using oracle 10g
Re: need help Column to rows [message #424816 is a reply to message #424814] Tue, 06 October 2009 02:21 Go to previous message
Michel Cadot
Messages: 63806
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
This does not answer any of my requirements.
And you didn't search for what delna.sexy asked you.

Regards
Michel
Previous Topic: compare two columns in same table
Next Topic: Oracle date function
Goto Forum:
  


Current Time: Tue Sep 27 16:07:24 CDT 2016

Total time taken to generate the page: 0.11949 seconds