Home » SQL & PL/SQL » SQL & PL/SQL » Hi
Hi [message #242582] Mon, 04 June 2007 03:40 Go to next message
nirmalnarayan
Messages: 261
Registered: April 2005
Location: India
Senior Member
The following table has

create table emp(empname varchar2(100),join_date date);

how to display the data in this table in following format ?

EMPNAME JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC
-------------------------------------------------------------------------------
Mark 01/06
Allen 23/05



Like that. Here Mark's join date is 01st Feb of 2006 and Allen's join date is 23rd May 2005.

Can anyone help with queryt To display data in this format in a single query,

Thanks

Nirmal

[Updated on: Mon, 04 June 2007 03:43]

Report message to a moderator

Re: Hi [message #242583 is a reply to message #242582] Mon, 04 June 2007 03:53 Go to previous messageGo to next message
pablolee
Messages: 2835
Registered: May 2007
Location: Scotland
Senior Member
Search these forums for the keyword 'PIVOT' there are many, many examples that will help you.
Re: Hi [message #242608 is a reply to message #242582] Mon, 04 June 2007 05:54 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
241 messages and you still neither know How to format your posts nor read How to get a quick answer to your question: TIPS AND TRICKS.

I think it is just a waste of time to help you, you cant' never learn something.

Regards
Michel
Re: Hi [message #242631 is a reply to message #242582] Mon, 04 June 2007 08:15 Go to previous messageGo to next message
joy_division
Messages: 4643
Registered: February 2005
Location: East Coast USA
Senior Member
What a stupid subject for a message, and after 240 messages.
Re: Hi [message #242778 is a reply to message #242631] Tue, 05 June 2007 01:43 Go to previous message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
Now this brings back memories. Didn't you start a thread on pivoting some time ago (about 2 years, September 2005 or so)?

But you know the drill:
- show us what you have.
- show us what results you got
- show us an expected output WITH CODE TAGS.

But here's a tip: A DECODE could help you out. you'll need 12 DECODE (or CASE) statements.

MHE
Previous Topic: Forgot UserName and Password for SQL Plus..What NOW??:
Next Topic: How to find if a VARCHAR2 variable has contains a numeric data or not
Goto Forum:
  


Current Time: Thu Dec 08 12:11:58 CST 2016

Total time taken to generate the page: 0.26779 seconds