[thelist] simple(?) SQL question
Raul Beltran
espiritudelvino at hotmail.com
Thu Sep 21 14:48:52 CDT 2000
----- Original Message -----
From: "dave gray" <dascott at wam.umd.edu>
> select domain,acct_type from account where login='imalogin'
> then based on that, i do:
> select setup_fee,monthly_fee from plan where acct_type='from_above';
>
> so what i want my new magical query to return is:
> domain,acct_type,setup_fee,monthly_fee
>
> except the two fees i want to get are in a different table and i don't
> know the magic syntax for that!
>From the statements you give, this is an untested version of what you might
want to obtain:
SELECT acount.domain, account.acct_type, plan.setup_fee, plan.monthly_fee
FROM account, plan
WHERE (account.login = 'imalogin') AND (date.acct_type =
account.acct_type);
I am not sure wether both tables have a column called acct_type, if that is
the case, this magic syntax (actually called INNER JOIN) should work.
If you are serious about developing SQL applications, you should read
several sql tutoriasl such as http://www.sqlcourse.com
Raul Beltran.
More information about the thelist
mailing list