Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Okay, maybe a silly basic SQL question, but
Hello all,
I'm just starting to code in PL/SQL and am
still learning SQL too! So, hopefully this question is not too basic or
painfully obvious!
I have 3 tables - one contains a user_name, the next has the user_name and
the account_no (an association table between users and accounts) ,
the third has the account_no and the account_name. I need the user_name and
its associated account_name.
I did a join on the 3 tables to get my desired results (hopefully I did this correctly), but I'm wondering if there is a more succinct and better way of getting the desired results. Aren't 3 way joins costly? And if so, what are other options?
Example of what I've come up with:
select u.user_name, u.status,
decode(u.status, 1, 'Temporarily Suspended', 2, 'Permanently Suspended', 3,
'Password Reset', 4,
'First Login', ' ') as statusdesc, a.account_name
from user u, user_acct_asc ua, account a
where
u.status <> 0
and u.status_date between sysdate-1 and sysdate
and u.user_name = ua.user_name
and ua.domain_id = a.domain_id;
Received on Fri Dec 29 2000 - 12:38:29 CST
![]() |
![]() |