You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by "Caron, Roger A." <ro...@pw.utc.com> on 2004/05/18 21:08:59 UTC

Criteria: Multiple Instances of same table

I'm trying to run a query which compares IDs in two tables against the IDs
of a third, based on criteria set on the third.  The problem is that the two
tables I want to return have to use different data sets from the third since
they're not identical.

Here's my actual situation:
Table 1: PERMISSIONS
Table 2: OBJECT1
Table 3: OBJECT2

My permissions works similar to a tree, where if you have access to OBJECT1,
you may have access to OBJECT2, but just because you have permission to
OBJECT2 doesn't guarantee you access since you may not be able to access
OBJECT1.

So what I'm looking for is something to get the following sql:

select OBJECT2.objectName from OBJECT2, OBJECT1, PERMISSIONS A, PERMISSIONS
B where OBJECT2.permissionId=A.permissionId and
OBJECT1.permissionId=B.permissionId and A.usersWithAccess="roger" and
B.usersWithAccess="roger"

This way I can test if "roger" has access to OBJECT2 and OBJECT1 and
therefore display OBJECT2.

Any suggestions on how to get multiple instances of the PERMISSIONS table?

Thanks

Roger 


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org