| How to convert rows into column (2 Merged) [message #567253] |
Tue, 25 September 2012 12:12  |
 |
rituraj.2713
Messages: 1 Registered: September 2012
|
Junior Member |
|
|
How to convert station & date wise multiple rows to date wise coloumn
I have a table TEST like this,
STN_Name Date State
DELHI 1-Sep-201 G
DELHI 2-Sep-201 B
DELHI 3-Sep-201 G
DELHI 4-Sep-201 G
DELHI 5-Sep-201 G
DELHI 6-Sep-201 M
DELHI 7-Sep-201 G
DELHI 8-Sep-201 G
DELHI 9-Sep-201 G
DELHI ......... ..
DELHI 30 Sep 2012 G
KOLKATA 1-Sep-201 G
KOLKATA 2-Sep-201 B
KOLKATA 3-Sep-201 B
KOLKATA 4-Sep-201 B
KOLKATA 5-Sep-201 G
KOLKATA 6-Sep-201 M
KOLKATA 7-Sep-201 G
KOLKATA 8-Sep-201 G
KOLKATA 9-Sep-201 B
I want output like this
STN_Name 1-Sep-2012 2-Sep-2012 3-Sep-2012 4-Sep-2012 5-Sep-2012 ............Sep 2012
DELHI G B G G G M
KOLKATA G B B B G M
Please help me with suitable SQL query in 10G or above
|
|
|
|
|
|
| Re: How to convert rows into column (2 Merged) [message #567261 is a reply to message #567253] |
Tue, 25 September 2012 12:39  |
 |
Michel Cadot
Messages: 54650 Registered: March 2007 Location: Nanterre, France, http://...
|
Senior Member Account Moderator |
|
|
Welcome to the forum.
Please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, 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.
With any SQL or PL/SQL question, Post a working Test case: create table and insert statements along with the result you want with these data then we will be able work with your table and data. Explain with words and sentences the rules that lead to this result.
In the end, search before any post, this question is a FAQ.
Regards
Michel
|
|
|
|