combining mysql calls

Discussion in 'OT Technology' started by RyanL, Nov 29, 2005.

  1. RyanL

    RyanL OT Supporter

    Joined:
    Nov 30, 2004
    Messages:
    4,584
    Likes Received:
    0
    Location:
    St. Paul, MN
    Is there a way to combine mysql calls so that I don't have to make two seperate calls to a tables?

    IE
    Code:
    SELECT feildc FROM tablex WHERE feilda='1'
    and then make the second call with the data pulled from the first...
    Code:
    SELECT * FROM tabley WHERE feildc='id'
    I'm pretty sure that there is a way to do this, I just dont know it...;)
     
  2. SLED

    SLED build an idiot proof device and someone else will

    Joined:
    Sep 20, 2001
    Messages:
    28,118
    Likes Received:
    0
    Location:
    AZ, like a bauce!
    if you want the results in the same dataset, you can use a UNION statement. You'll need to make sure the columns from both tables match.
     
  3. Keyzs

    Keyzs OT Supporter

    Joined:
    Nov 3, 2003
    Messages:
    814
    Likes Received:
    0
    Location:
    Charlotte, MI
    Code:
    SELECT TableY.*
    FROM TableY INNER JOIN TableX ON TableY.Fieldc = TableX.Fieldc
    WHERE TableX.Fielda = 1;
    
     

Share This Page