Ok so

SELECT * FROM Events, Djs, EventDjs WHERE Events.eventID = EventDjs.eventID 
AND Djs.DJID = EventDjs.DJID;

should give you a list with the event and the dj etc, if you only want one 
event then add something like AND Events.Events.eventID = 'x' or whatever.

cheers,

noel

On Tuesday, July 17, 2001 8:06 AM, Technodium.net 
[SMTP:[EMAIL PROTECTED]] wrote:
> Well, let me give the complete details
>
> Let's say I have one table called events
> with fields eventID and eventName
>
> Then one table called djs
> with fields djID and djName
>
> And finally a table linking them all called eventdjs
> with fields called eventID and djID
> this table links one event with all the appropriate djs.
>
> I use the same linking tables for outlets and other infos.. those are 
many
> to many relations.
>
> Now I want to select all djs from one event, this means taking info from
> events and djs table, but using the 3rd table for the link.. that's what 
I'm
> not able to do.
>
> There is a way to do it with a script that takes the list of djID from 
the
> link table and then makes a new select.. but I'm sure there is a way to 
do
> it at once..
>
> I looked in the MySQL book from paul dubois and somewhere it states how 
to
> change subselects into selects for mysql, but I can't acheive my goal.
>
> Any help appreciated
>
> Etienne
>
> > ----- Original Message -----
> > From: "Simon Green" <[EMAIL PROTECTED]>
> > To: "'Technodium.net'" <[EMAIL PROTECTED]>;
> <[EMAIL PROTECTED]>
> > Sent: Monday, July 16, 2001 8:56 AM
> > Subject: RE: Beginner help with selecting
> >
> >
> > > Ok
> > > So you give the event an ID and the DJ and Id
> > >
> > > Select dj.djid
> > > from dj, event
> > > where event.eventid = 'x';
> > >
> > > I think this should work?
> > > Long weekend so if this is not right it should be close!
> > >
> > > Simon
> > >
> > > -----Original Message-----
> > > From: Technodium.net [mailto:[EMAIL PROTECTED]]
> > > Sent: 16 July 2001 13:41
> > > To: [EMAIL PROTECTED]
> > > Subject: Beginner help with selecting
> > >
> > >
> > > Hello there, I would need some help with a select statement for my
> > > databases.
> > >
> > > I've done all the design of the database and I think it's all good, 
but
> I
> > > can't make a select as I want to do it.
> > > There is the problem:
> > > I have one table for the list of events and one for the list of djs 
for
> > this
> > > event.
> > > I have also one linking table with the list of events keys with their
> > > according djs
> > >
> > > I would like to do a select so that for one event it gives me all the
> > djs..
> > > But I'm not able to do it.
> > >
> > > And after that I'd like to dothe same to be able to get the djs, the
> > > outlets, etc in less queries than getting the djs ID from the linking
> > table
> > > and then doing a new query in the dj table to get the info
> > >
> > > If you'd like more info please don't hesitate..
> > >
> > > This bug is stopping my progress in the DB design and I can't get 
help
> > > anywhere for this
> > >
> > > Etienne
> > >
> >
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail 
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to