SQL meaning

From: amonte <ax.mount_at_gmail.com>
Date: Tue, 28 Oct 2008 15:57:00 +0100
Message-ID: <85c1fb130810280757s45160be6g100abbf8d85f0d5c@mail.gmail.com>


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 (
                          SELECT ID
                            FROM orgattr
                           WHERE orgattr.attrname = 'CONTAINEDBYOBJECTGROUP'
                             AND attrval IN ('#ID#TOP'))

ORDER BY userobj.ID

select table_name, num_rows, last_analyzed from dba_tables where table_name in

TABLE_NAME                       NUM_ROWS LAST_ANAL
------------------------------ ---------- ---------
USERATTR                          1851675 20-OCT-08
USEROBJ                             64972 20-OCT-08
ORGATTR                              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

Received on Tue Oct 28 2008 - 09:57:00 CDT

Original text of this message