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

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL Dilemma!! Anyone.........

Re: SQL Dilemma!! Anyone.........

From: <arun.kamat_at_jp.fid-intl.com>
Date: Fri, 10 Dec 1999 05:33:46 GMT
Message-ID: <82q3bq$8lt$1@nnrp1.deja.com>


You need to play with 'group by' aggregates and joins.

select l.name, count(*)
from users u, logs l
where u.name = l.name
group by l.name

Check up reference manuals for how you can group results in various ways and the need to use joins to co-relate tables.

arun

  hallian_at_hotmail.com wrote:
>
> Is this possible to do in SQL with just my 2 tables:
> First Table: users
> Second Table: log
>
> USERS TABLE [1 FIELD] name
> sam
> john
> jack
> miller
>
> LOG TABLE [3 FIELDS] rec_no name desc
> 1 sam happy
> 2 jack unhappy
> 3 sam jolly
> 4 miller happy
> 5 sam smiley
> 6 john unhappy
>
> Now can I use SQL statements to loop through each entry from Table:
> USERS against each entry against Table: LOG. Is it possible!!!!
>
> sam 3 entries
> jack 1 entry
> miller 1 entry
> john 1 entry

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Thu Dec 09 1999 - 23:33:46 CST

Original text of this message

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