This topic is locked

2 inner join statements in one query

6/12/2007 6:43:16 AM
PHPRunner General questions
M
Momo99 author

Hi,
Is it possible to use two inner join statements in one query?

I have three tables:

  1. teachings
  2. masters
  3. discipline
    i want to pull data from all three of them in the same query. This is what i got:
    select teachings.primary_index,

    title,

    master_name,

    discipline_name

    From teachings

    inner join masters on teachings.master_id=masters.id

    inner join masters on teachings.discipline_id=discipline.id
    of course it doesn't work.

    can anyone tell me what is the correct syntax if its possible at all?
    tnx ahead

M
Momo99 author 6/12/2007

Hi,

Is it possible to use two inner join statements in one query?

I have three tables:

  1. teachings
  2. masters
  3. discipline
    i want to pull data from all three of them in the same query. This is what i got:
    select teachings.primary_index,

    title,

    master_name,

    discipline_name

    From teachings

    inner join masters on teachings.master_id=masters.id

    inner join masters on teachings.discipline_id=discipline.id
    of course it doesn't work.

    can anyone tell me what is the correct syntax if its possible at all?
    tnx ahead


Solved with a simple "where" statment