Re: Need help with Oracle 2 table join with the count function.

From: Gary Clift <gclift_at_avaya.com>
Date: 18 Jul 2001 14:07:35 -0700
Message-ID: <287b284e.0107181307.52e66010_at_posting.google.com>


I found the answers after lots of trial and error. Here is my final and successful answer.

SELECT a.bu_userid, a.bu_seclev, a.swlogin,

       count(c.bs_syslogid), count(b.bt_transid) FROM bot_user a, bot_transaction b, bot_system_log c WHERE a.bu_seclev < 0
AND b.bt_userid(+) = a.bu_userid
AND c.bs_userid(+) = a.bu_userid
GROUP BY a.bu_userid, a.bu_seclev, a.swlogin

Cheers,
Gary Clift

>
> SELECT a.bu_userid, a.bu_seclev, a.swlogin, count(b.bt_transid)
> FROM bot_user a, bot_transaction b
> WHERE a.bu_seclev < 0 AND b.bt_userid = a.bu_userid
> GROUP BY a.bu_userid
>
> Here is how the tables are built:
> BOT_USER
> -- bu_userid (PK)
> -- bu_swlogin
> -- bu_seclev
>
> BOT_TRANSACTION
> -- bt_transid (PK)
> -- bt_userid (FK to bot_user)
> &#8230;
> &#8230;
> &#8230;
>
Received on Wed Jul 18 2001 - 23:07:35 CEST

Original text of this message