Home » RDBMS Server » Server Administration » Matrix Query
Matrix Query [message #374694] Mon, 25 June 2001 09:37 Go to next message
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 messageGo to next message
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 messageGo to next message
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
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;
Previous Topic: Limit records returned by a select
Next Topic: Re: retriving last 10 rows
Goto Forum:
  


Current Time: Mon Dec 23 18:55:17 CST 2024