Home » SQL & PL/SQL » SQL & PL/SQL » Columns into Rows Thru ORACLE SQL
Columns into Rows Thru ORACLE SQL [message #355453] Fri, 24 October 2008 02:41 Go to next message
oracle_dev
Messages: 24
Registered: April 2007
Junior Member
I want to Pivot the query result thru oracle sql.
Thanks for your help.
Re: Columns into Rows Thru ORACLE SQL [message #355455 is a reply to message #355453] Fri, 24 October 2008 02:52 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
What did you try so far?
Tried searching? Tried some code that failed?
Re: Columns into Rows Thru ORACLE SQL [message #355456 is a reply to message #355455] Fri, 24 October 2008 03:05 Go to previous messageGo to next message
oracle_dev
Messages: 24
Registered: April 2007
Junior Member
this is my normal sql
SELECT dept_no,dept_name, SUM(NVL(col1,0)) col1,SUM(NVL(col2,0)) col2, SUM(NVL(col3,0)) col3
FROM emp a, dept b
WHERE end_date BETWEEN '' AND ''
AND a.dept_no = b.dept_no
GROUP BY dept_no,dept_name
Re: Columns into Rows Thru ORACLE SQL [message #355458 is a reply to message #355456] Fri, 24 October 2008 03:11 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
And? Does it work?
What output do you get? What output do you want?
What input do you use?

Read the Forum guide for guidelines on how to post a question and how to increase the chances on a useful answer
Re: Columns into Rows Thru ORACLE SQL [message #355487 is a reply to message #355456] Fri, 24 October 2008 07:43 Go to previous messageGo to next message
joy_division
Messages: 4640
Registered: February 2005
Location: East Coast USA
Senior Member
oracle_dev wrote on Fri, 24 October 2008 04:05

WHERE end_date BETWEEN '' AND ''



This will surely fail.
Re: Columns into Rows Thru ORACLE SQL [message #355495 is a reply to message #355453] Fri, 24 October 2008 08:29 Go to previous message
flyboy
Messages: 1832
Registered: November 2006
Senior Member
Just a guess: the original poster may be interested in the syntax for pivot queries introduced in Oracle version 11g.
It is described e.g. on these pages: http://www.orafaq.com/wiki/PIVOT
Previous Topic: Comparison between join and IN clause
Next Topic: date function
Goto Forum:
  


Current Time: Tue Dec 06 06:34:49 CST 2016

Total time taken to generate the page: 0.10194 seconds