mysql sql multi join question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Pete

    #1

    mysql sql multi join question

    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.OI D, venues.Name,
    venues.VID, venues.City, venues.State, productions.P_D ate
    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,prod uctions.PID, productions.EID ,productions.OI D,
    venues.Name,
    venues.VID, venues.City, venues.State, productions.P_D ate
    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
Working...