Re: [GENERAL] Many-to-many problem

2010-03-19 Thread Raymond O'Donnell
On 18/03/2010 23:18, Grant Allen wrote: > Hi Raymond, > >> From a strictly relational viewpoint, this is as easy as > > (select users.uid, apps.appcode from apps, users) > except > (select canaccess.uid, canaccess.appcode from canaccess) Joe & Grant, thanks for your replies... I knew it had to b

Re: [GENERAL] Many-to-many problem

2010-03-18 Thread Grant Allen
Hi Raymond, From a strictly relational viewpoint, this is as easy as (select users.uid, apps.appcode from apps, users) except (select canaccess.uid, canaccess.appcode from canaccess) In english, that's the cartesian product of all users' uid and apps appcode minus the known set of user+app a

Re: [GENERAL] Many-to-many problem

2010-03-18 Thread Joe Conway
On 03/18/2010 03:50 PM, Raymond O'Donnell wrote: > > I can do it easily enough for one user; my problem is doing it for all > users in one fell swoop. > > I'm sure this is a very common problem, but I just can't see the > solution, so any pointers would be greatly appreciated. Is this what you w

[GENERAL] Many-to-many problem

2010-03-18 Thread Raymond O'Donnell
G'night all, I'm being driven nuts by an SQL problem which I think ought to be simple, but I can't see the answer. I have two tables related many-to-many via a third - they describe a set of users, a set of applications and which users have been granted access to which applications. What I want i