Help Needed

From: Pankaj <>
Date: Tue, 10 Nov 2009 13:43:56 -0800 (PST)
Message-ID: <>


Table structure



role           user
12	James
23	James
1002	James
9000	James
50000	James
9000	Scott
23	Brian
9000	Brian
50000	Sushil
45             Moore

I have this enhancement where I have to EXCLUDE all users with roles < 1000 but keeping following in mind
1) role < 1000 and user should not be in any other role OR
2) role < 1000 and role BETWEEN 9000 and 9010 and user should not be in any other role.

So using above sample data, we should only receive one user i.e Moore to be excluded using above logic (as his role is < 1000 and satisfy aboove two requirements)

This is driving me crazy since yesterday. Whatever I do, it someway or the other violates the requirement and I end up having incorrect result. I just need to know how to come up with a query to EXCLUDE users using above logic.

Any help would be greatly appreciated. Received on Tue Nov 10 2009 - 15:43:56 CST

Original text of this message