473,396 Members | 1,965 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

query to convert column into rows in oracle9i

hi all

i am having a table in d form

COLNAME VALUE
NAME ABC
ROLLNO 2
ADDRESS DELHI
CLASS 12TH
NAME CDE
ROLLNO 3
ADDRESS PUNE
CLASS BSC
NAME EFG
ROLLNO 4
ADDRESS CHD
CLASS MCA

And i want d output in the following format by using some query in oracle 9i.

NAME ROLLNO ADDRESS CLASS
ABC 2 DELHI 12TH
CDE 3 PUNE BSC
EFG 4 CHD MCA


can sombody help me regarding ds?

thnx in advance
aman
Nov 30 '07 #1
4 3423
debasisdas
8,127 Expert 4TB
Find realted topic a here and few others in the How To section of oracle.
Nov 30 '07 #2
I Had Created The Table
As T1

Colname Value
Name Cde
Roll 3
Class Bsc
Address Pune
Name Efg
Roll 2
Class 12
Address Delhi
Name Abc
Roll 4
Class Mca
Address Chd


Now To Select D Data I Used D Query

Select (case When Colname ='name' Then Value End) As Name
,(case When Colname ='roll' Then Value End) Roll
,(case When Colname ='class' Then Value End) Class1
From T1
Order By Colname

It Gives Following Output

Name Roll Class1
' ' ' ' ' '
' ' ' ' ' '
' ' ' ' ' '
' ' ' ' Bsc
' ' ' ' Mca
' ' ' ' 12
Cde ' ' ' '
Abc ' ' ' '
Efg ' ' ' '
' ' 3 ' '
' ' 4 ' '
' ' 2 ' '

It Gives Gaps

But I Want In Following Format

Name Roll Class1
Cde 3 Bsc
Abc 4 Mca
Efg 2 12
Nov 30 '07 #3
QVeen72
1,445 Expert 1GB
Hi,

There must be some ID for the Table,..

NAME ABC
ROLLNO 2
ADDRESS DELHI
CLASS 12TH

All the above 4 rows, should have Some Common Field Value..
What is the ID Column here....? This is Required for Pivoting ...

Regards
Veena
Dec 1 '07 #4
No but there is no field like dt
Dec 3 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Russell | last post by:
I'm having a fit with a query for a range of dates. The dates are being returned from a view. The table/field that they are being selected from stores them as varchar and that same field also...
1
by: yzhao12 | last post by:
Hi everyone, I encountered an error "Need to run the object to perform this operation Code execution exception: EXCEPTION_ACCESS_VIOLATION " When I try to import data from Oracle to MS...
8
by: Lauren Quantrell | last post by:
In VBA, I constructed the following to update all records in tblmyTable with each records in tblmyTableTEMP having the same UniqueID: UPDATE tblMyTable RIGHT JOIN tblMyTableTEMP ON...
1
by: Alex Satrapa | last post by:
I have a table from which I'm trying to extract certain information. For historical reasons, we archive every action on a particular thing ('thing' is identified, funnily enough, by 'id'). So the...
3
by: Matthew Kramer | last post by:
How would be the best way to do this in Access? I have two tables. The first table has all the rows of data. The first column of this table has a country name, the second has a year and the...
6
by: jjturon | last post by:
Can anyone help me?? I am trying to pass a Select Query variable to a table using Dlookup and return the value to same select query but to another field. Ex. SalesManID ...
2
by: Nenad Markovic | last post by:
Hi everybody, When executing a Crosstab Query I see only rows (defined in a row heading) that have values (defined in value field) in at least one column (defined as column headings). How can...
8
by: s_wadhwa | last post by:
SELECT DISTINCTROW "01C" AS dummy, Buildings.BuildingNumber, UCASE(Buildings.BuildingName) AS BuildingName, Buildings.MasterPlanCode, Buildings.UniformBuildingCode,...
5
by: troy | last post by:
Could someone please point me in the right direction on how to read in a large query with .net. I am trying to emulate a legacy database system so I don't know the upper bounds of the sql query....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.