Jump to content

[SOLVED] Query from many to many relationship


jellis

Recommended Posts

Hi all,

 

Long time reader, first time poster.

 

I'm absolutely stuck.  I have the following table structure.

 

Presentations

pres_id

title

description

date

 

Speakers

speak_id

fname

lname

bio

 

Speakpres

sp_id

speak_id

pres_id

 

I've written a page to display the information from a presentation.  It queries the database based on the pres_id and returns those values... no problems.

 

The problem arises when I try to return the presenter(s) from the presentation.  I've tried numerous ways to return these values but I just cannot get it to work.

 

My latest idea was this:

 

"SELECT fname, lname FROM conf2007_speakers AS s, conf2007_speakpres AS sp WHERE sp.pres_id = '$pres_id' AND s.speak_id = sp.speak_id"

 

but this is obviously wrong...

 

Thanks for any input.

 

Josh

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.