Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Tricky query?

Tricky query?

From: JZ <ibm_97_at_yahoo.com>
Date: 26 Aug 2004 13:32:09 -0700
Message-ID: <10bc841c.0408261232.71f24b19@posting.google.com>


Hi,

Oracle 9205

I have a table:

SQL> select * from ASSETGROUPSMAPPINGS;

ASSETGROUPID ASSETID
------------ ----------

           1          1
           1          3
           1          4
           1          6
           2          3
           2          5


Now I like to have a query which can return a common 'assetgroupid' for a list of 'assetid'. I know it can be done through 'intersect':

SQL> select unique ASSETGROUPID from ASSETGROUPSMAPPINGS where ASSETID =3 intersect select unique ASSETGROUPID from ASSETGROUPSMAPPINGS where ASSETID =5; ASSETGROUPID


           2

The problem is that the number of 'assetid' is not fixed, it could be 2, 3, or 6. So it's difficult to implement into our JAVA code.

Any ideas?

Thanks a lot! Received on Thu Aug 26 2004 - 15:32:09 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US