how to get the data from table with join

Discussion in 'PHP' started by dineshsingh1984, Jun 16, 2011.

  1. #1
    I'm created two table first one is test1 and second one is test2.
    In first table one field is id and in second table one field is id.
    in first table two data/value insert 1 and 2 and second table four data/value insert 1, 2, 3 and 4

    I want to acess only 3 and 4 data with use join key

    how can do this???????????
    plz help me.....................
     
    dineshsingh1984, Jun 16, 2011 IP
  2. lukeg32

    lukeg32 Peon

    Messages:
    645
    Likes Received:
    19
    Best Answers:
    1
    Trophy Points:
    0
    #2
    What is the relationship between the tables? Is the ID field the fkey you are using?

    If so, then this should be what you are after - you will have to substitute the relevant parts/names since you do not give full details;

    SELECT two.column3, two.column4 from tableone as one inner join tabletwo as two ON (two.id = one.id)
    Code (markup):
     
    lukeg32, Jun 16, 2011 IP
  3. dineshsingh1984

    dineshsingh1984 Active Member

    Messages:
    154
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #3
    I will try............


     
    dineshsingh1984, Jun 16, 2011 IP