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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Using Count in SQL against a join...

Re: Using Count in SQL against a join...

From: <svemulapalli_at_my-deja.com>
Date: Wed, 04 Oct 2000 14:27:53 GMT
Message-ID: <8rfeov$ujo$1@nnrp1.deja.com>

In article <39DA37B2.BF6D342C_at_grc.nasa.gov>,   Sean Alderman <sean.m.alderman_at_grc.nasa.gov> wrote:
> All,
> I've been away from SQL (and databases in
 general) since college,
> but I find myself struggling with what seems
 like a rather simple query
> -
>
> It involves 2 tables --
> Return Hit count on all Audited items for the
 users userA, UserB,
> UserC. The Audit table contains the UserID,
 not the UserName, so I've
> got this query returning the UserID working -
>
> Select Audit.UserID, count(*)
> from Audit
> where Audit.UserID = 1575012 or Audit.UserID =
 1575038 or Audit.UserID =
> 1575512
> group by Audit.UserID
>
> Now I want to change the UserID field in the
 output to the UserName
> field, but it's in a different table. So
 wouldn't I --
>
> Select UserInfo.UserName, count(Audit.*)
> From UserInfo, Audit
> Where Audit.UserID = 1575012 or Audit.UserID =
 1575038 or Audit.UserID
> = 1575512
> And UserInfo.UserID = Audit.UserID
> Group by UserInfo.UserID
>
> It tells me I'm tring to acces an invalid
 column. Any I deas? For a
> moment I thought that I needed to modify the
 count statement to show
> Audit.* or something...but that doesn't seem to
 work either.
>
> Thanks.
>
>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Wed Oct 04 2000 - 09:27:53 CDT

Original text of this message

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