Re: SQL meaning

From: Stephane Faroult <sfaroult_at_roughsea.com>
Date: Tue, 28 Oct 2008 16:29:11 +0100
Message-Id: <65496.1225207751@roughsea.com>


Alex,

  No, you can't remove the condition. You have attrl as a user attribute, as well as an "org" (group, presumably) attribute. I wouldn' have designed like this but basically the condition says "the user has this characteristic or s/he belongs to a group that has this characteristic". Something akin to "the user has this privilege or has a role that has this privilege".

HTH

S Faroult

 



On Mar Oct 28 15:57 , amonte sent:

Hi

I have the following query for an Identity Management Tool:

SELECT   userobj.ID, NAME, summary
    FROM userobj
   WHERE userobj.NAME LIKE 'A%'
     AND userobj.ID IN (
            SELECT ID
              FROM userattr
             WHERE (   attr1 IN ('#ID#TOP')
                    OR attr1 IN (
        & nbsp;                 SELECT ID
                            FROM orgattr
                           WHERE orgattr.attrname = 'CONTAINEDBYOBJECTGROUP'
                             AND attrval IN ('#I D#TOP'))
                   ))
ORDER BY userobj.ID


select table_name, num_rows, last_analyzed from dba_tables where table_name in
('USEROBJ', 'USERATTR', 'ORGATTR');

TABLE_NAME                        NUM_ROWS LAST_ANAL
------------------------------ ---------- ---------
USERATTR                          1851675 20-OCT-08
USEROBJ                             64972 20-OCT-08
ORGATTR            & nbsp;                 2251 20-OCT-08

I am having difficulty understanding the query, for example the condition " attr1 IN ('#ID#TOP') " can it be taken out to the outer query and not used in the subquery?


TIA

Alex



-- http://www.freelists.org/webpage/oracle-l Received on Tue Oct 28 2008 - 10:29:11 CDT

Original text of this message