Use result from 1 query make new query

Discussion in 'Databases' started by b.devroey, Apr 13, 2011.

  1. #1
    Good evening

    I'm busy making a script but i'm am stuck....

    How can i...

    If i have te results from the first query, use it to find and print other result in other table....

    -------------
    query results from table A and retreve
    - Contains Name, telefone, info,
    Use the name of table A and find in Table B and retreve
    - Name, Adres, zipcode,

    while $row mysql_fetch_array($result)
    Echo all in 1 array
    - Name (Table A)
    - Telephone (Table A)
    - Info (Table A)
    - Adres (Table B)
    - Zipcode (TableB)


    Hope some can help me(im a little noob)
     
    b.devroey, Apr 13, 2011 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    I would probably do a join so that you only need 1 query.

    SELECT table_1.columns, table_2.columns FROM table_1 LEFT JOIN table_2 ON table_1.Name = table_2.Name;
     
    jestep, Apr 14, 2011 IP
    b.devroey likes this.
  3. b.devroey

    b.devroey Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    SOLVED thanxxx
     
    b.devroey, Apr 15, 2011 IP