dbTalk Databases Forums  

mysql sql multi join question

mailing.database.mysql mailing.database.mysql


Discuss mysql sql multi join question in the mailing.database.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Pete
 
Posts: n/a

Default mysql sql multi join question - 09-07-2004 , 04:47 PM






hello i am a novice at database design and i'm having trouble doing a
multi join in mysql, i was able to do a inner join with
just the venues and productions tables below like so

SELECT productions.PID, productions.EID,productions.OID, venues.Name,
venues.VID, venues.City, venues.State, productions.P_Date
FROM productions
INNER JOIN venues ON productions.VID = venues.VID
where productions.VID=50

i want to join all 3 tables so that i can present them all different
sorts of ways in html tables, but i haven't been able to get
the sql statement to execute, i basically want it so that i can get i
can do something like

SELECT events.EID,productions.PID, productions.EID,productions.OID,
venues.Name,
venues.VID, venues.City, venues.State, productions.P_Date
FROM productions
INNER JOIN venues ON productions.VID = venues.VID
INNER JOIN events ON productions.EID = events.EID
where productions.VID=50

i tried doing AND and tried doing different types of joins also but
i'm getting errors and figured that someone maybe be able to explain
how i can go about doing this in the best manner.

here are the tables below:

events table
-------------
Field Type Attributes Null Default Extra Action
EID smallint(6) No 0
E_Name varchar(250) No
E_Type tinyint(4) No 0

venues table

Field Type Attributes Null Default Extra Action
VID smallint(6) No 0
Name varchar(255) No
City varchar(200) No
State char(2) No
ZipCode varchar(7) No
RegionId smallint(6) Yes 0
MarketId smallint(6) Yes 0

productions table
---------------------
Field Type Attributes Null Default Extra Action
PID mediumint(9) No 0
OID smallint(6) No 0
EID smallint(6) No 0
VID smallint(6) No 0
P_Date datetime No 0000-00-00 00:00:00


thanks, Tom

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.