mahjag
asked on
get oracle rows as columns
I need to write a report from oracle sql that outputs the rows like columns so the analyst can compare the value
The output from oracle comes out to be
Year month Product Stats
200901 ABC 50.00
200902 ABC 40.00
it should look like
Product Jan2009 STATS Feb 2009 STATS DElta (col3-5)
The output from oracle comes out to be
Year month Product Stats
200901 ABC 50.00
200902 ABC 40.00
it should look like
Product Jan2009 STATS Feb 2009 STATS DElta (col3-5)
Are you looking for an arbitrary number of columns or just the two columns with the delta?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I changed table name and executed it and I got dup rows of about 300 - am I missing any join here
The sample data you gave contained only two rows. Perhaps you can explain your data in more detail?
How many rows and columns you have in your table?
ASKER
I got the sql t work it was missing the where clause which I have to restrict,my only question is the table that I am refering to is already a view of 2 bigger tables of more than million rows, the query takes more time to execute just for a month as against directly querying the table for a month -
Yes, that is because views do not help speed up anything. they are simply stored queries. If you want to speed it up you'll need to create indexes on the columns that you are searching / limiting by.
Possibly the month column is not indexed.
Possibly the month column is not indexed.