Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Need help for writing a query
In our last gripping episode "Reinier" <Reinier_Dickhout_at_hetnet.nl>
wrote:
> select a.player
> from player_games a
> where not exists
> (select b.game
> from player_games b
> where not exists
> (select c.player
> from player_games c
> where c.game = b.game
> and c.player = a.player
> )
> )
>
> or something like this..
>
> This should list the players that play all the games.
>
> Reinier.
>
> Khemraj DOOKHEE <kdookhee_at_capgemini.fr> wrote in message
> news:8uoql9$jcb$1_at_s1.read.news.oleane.net...
> > Sorry,
> >
> > I forgot to mention that the query should be able to give the name
of
> > players who play all of the games found in a list,
> > where the list would be something like :
('GAME1', 'GAME2', 'GAME3', ...,
> > 'xxx').
> >
> > Thanks,
> > Khemraj.
> >
> > "Khemraj DOOKHEE" <kdookhee_at_capgemini.fr> a écrit dans le message
news:
> > 8uolds$gfh$1_at_s1.read.news.oleane.net...
> > > Hi everyboby,
> > >
> > > I've got a table named 'PLAYER_GAMES' with the following data
structure
> > > (PLAYER varchar2(10), GAME varchar2(25)).
> > > The table is filled as follows :
> > >
> > > PLAYER GAME
> > > --------------------------------------------
> > > TOM FOOTBALL
> > > PETER BASKET-BALL
> > > PETER TENNIS
> > > PAUL VOLLEY-BALL
> > > PAUL TENNIS
> > > TOM BASKET-BALL
> > > TOM RUGBY
> > > STEVE FOOTBALL
> > > STEVE RUGBY
> > >
> > >
> > > Can anyone help me in writing the query which gives the name of
players
who
> > > play BOTH football and rugby ?
> > >
> > > Thanks in advance,
> > > Khemraj.
> > >
> > >
> >
> >
>
>
To implement the query as specified, i.e. to process a list of sports and find all players satisfying that list, I can only end up with PL/SQL as an option utilizing PL/SQL tables and, as far as I can tell, the solution becomes far more complex than simple queries.
Of course, I've been known to be wrong...
-- David Fitzjarrell Oracle Certified DBA Sent via Deja.com http://www.deja.com/ Before you buy.Received on Wed Nov 15 2000 - 09:57:27 CST