Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Okay, maybe a silly basic SQL question, but

Okay, maybe a silly basic SQL question, but

From: Susan E Teague <Susan_at_fileFRENZY.com>
Date: Fri, 29 Dec 2000 13:38:29 -0500
Message-Id: <10725.125464@fatcity.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US