Re: Indexing View Columns?

From: NewUser2008 <mcseven_at_gmail.com>
Date: Thu, 10 Mar 2011 07:33:54 -0800 (PST)
Message-ID: <81e2316f-d4a2-4ddd-b83c-dbd6c8a89bc5_at_q14g2000vbf.googlegroups.com>



Hi,

thanks for your reply. Nah, sorry, it's not that easy. I'm trying to find an alternative group management method on database level that is able to manage both explicit group assignment and implicit assignment via an sql statement.

For instance (simplified tables here):

TABLE IDENTITY:
===
- id

  • name

TABLE GROUPS
===
- id

  • name

TABLE EXPLICIT_ASSIGN
===
- ident_id

  • group_id

VIEW IMPLICIT_ASSIGN -- simplified code... ===
SELECT ident_id, 512 FROM employeeData WHERE -- several conditions UNION ALL
SELECT ident_id, 13012 FROM someOtherTable WHERE -- several conditions UNION ALL
SELECT ident_id, 4099 FROM thirdTable WHERE -- several conditions

with the purpose of handling those groups seamlessly:

VIEW ALL_GROUPS
===
SELECT * FROM EXPLICIT_ASSIGN
UNION ALL SELECT * FROM IMPLICIT_ASSIGN So one only needs to know the group number to get its members. The purpose of not using higher level scripting is that I a) can use this technique on the database level within triggers and stuff and
b) feed it SUBQUERIES like SELECT * FROM all_groups WHERE group_id IN (...)

Thanks, NewUser2k8 Received on Thu Mar 10 2011 - 09:33:54 CST

Original text of this message