Re: Help with DECODE function and crosstab query

From: Siva Valiveru <linuxurl_at_yahoo.com>
Date: 7 Oct 2003 22:09:03 -0700
Message-ID: <e4c73cce.0310072109.2b855e0d_at_posting.google.com>


/* create table gtbl(ComputerID number,ItemID number,Property varchar2(20),value varchar2(20));  

insert into gtbl values(1,1,'Name','Visio');
insert into gtbl values(1,1,'Vendor','Microsoft');
insert into gtbl values(1,1,'InstallDate','100103');


insert into gtbl values(1,2,'Name','Symnatec');
insert into gtbl values(1,2,'Vendor','Norton'); insert into gtbl values(1,2,'InstallDate','092503');

*/

SQL Query:

  1 select

  2   max( decode( property, 'Name', value, null ) ) Software,
  3   max( decode( property, 'Vendor', value, null ) ) Vendor,
  4   max( decode( property, 'InstallDate', value, null ) ) Installed
  5 from gtbl
  6 where computerid = &cid
  7* group by itemid
SQL> /
Enter value for cid: 1
old 6: where computerid = &cid
new 6: where computerid = 1

SOFTWARE VENDOR INSTALLED

-------------------- -------------------- --------------------
Visio                Microsoft            100103
Symnatec             Norton               092503

Regards,
Siva Valiveru Received on Wed Oct 08 2003 - 07:09:03 CEST

Original text of this message