By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,587 Members | 1,168 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,587 IT Pros & Developers. It's quick & easy.

Help with a select statement!

P: n/a
Hi.

I have a simple query that is similar to this one:

SELECT distinct b.username from permissions a, users b, links c where
a.user_id = b.id and c.information = 14;

In this case, it selects the all users details from table 'user' that are
permissioned to access a certain information with id = 14.

The problem is that I need to select the users that are not permissioned but
I have sql v3.23 and I canot use union.

In other words, I need to do a select b.username from users b where
b.username not in "the result" of the last select.

Can you give me a help?

Thanks,
Ana
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Ferreira wrote:
SELECT distinct b.username from permissions a, users b, links c where
a.user_id = b.id and c.information = 14;

In this case, it selects the all users details from table 'user' that are
permissioned to access a certain information with id = 14.

The problem is that I need to select the users that are not permissioned but
I have sql v3.23 and I canot use union.


Does this give the results you need?

select distinct b.username
from permissions a on a.user_id = b.id inner join links c
on (a.something = c.something and c.information = 14)
right outer join users b on a.user_id = b.id
where a.user_id is null;

You omitted the join criteria for how links is related to the other
tables, so substitute the "something" identifiers for your actual join
columns.

Regards,
Bill K.
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.