Home » RDBMS Server » Server Administration » Matrix Query
Matrix Query [message #374694] |
Mon, 25 June 2001 09:37 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
rajfaq
Messages: 2 Registered: June 2001
|
Junior Member |
|
|
Hi,
I have a query to generate the Matrix Report. But the data that needs to be displyed is char. So I can not do the sum. Is there any other solution.
select *
from
(select
name,
decode(id,10,id_val) COLUMN1,
decode(id,20,id_val) COLUMN2
from table1
)
Right now the query output looks like this.
NAME COLUMN1 COLUMN2
Name1 seg_val1
Name2 seg_val1
Name1 seg_val2
Name2 Seg_val2
I want the out put to be like this.
NAME COLUMN1 COLUMN2
Name1 seg_val1 seg_val2
Name2 seg_val1 Seg_val2
Any help would be greately appreciated.
Thanks...Raj
|
|
|
Re: Matrix Query [message #374696 is a reply to message #374694] |
Mon, 25 June 2001 10:56 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Vishnu Murty
Messages: 16 Registered: June 2001
|
Junior Member |
|
|
select x.name,x.column1,y.column2
from
(select *
from
(select
name,
decode(id,10,id_val) COLUMN1,
decode(id,20,id_val) COLUMN2
from table1
) ) x ,
(select *
from
(select
name,
decode(id,10,id_val) COLUMN1,
decode(id,20,id_val) COLUMN2
from table1
) ) y ,
where x.name = y.name
and x.column2 is null
and y.column1 is null;
|
|
|
Re: Matrix Query [message #374697 is a reply to message #374694] |
Mon, 25 June 2001 11:01 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Vishnu Murty
Messages: 16 Registered: June 2001
|
Junior Member |
|
|
select x.name,x.column1,y.column2
from
(select *
from
(select
name,
decode(id,10,id_val) COLUMN1,
decode(id,20,id_val) COLUMN2
from table1
) ) x ,
(select *
from
(select
name,
decode(id,10,id_val) COLUMN1,
decode(id,20,id_val) COLUMN2
from table1
) ) y ,
where x.name = y.name
and x.column2 is null
and y.column1 is null;
|
|
|
Re: Matrix Query [message #374700 is a reply to message #374694] |
Mon, 25 June 2001 11:05 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
Vishnu Murty
Messages: 16 Registered: June 2001
|
Junior Member |
|
|
select x.name,x.column1,y.column2
from
(select *
from
(select
name,
decode(id,10,id_val) COLUMN1,
decode(id,20,id_val) COLUMN2
from table1
) ) x ,
(select *
from
(select
name,
decode(id,10,id_val) COLUMN1,
decode(id,20,id_val) COLUMN2
from table1
) ) y ,
where x.name = y.name
and x.column2 is null
and y.column1 is null;
|
|
|
Goto Forum:
Current Time: Thu Sep 12 03:56:49 CDT 2024
|