Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #30159
    thisishard
    Member

    I have two tables in the database, tableOne and tableTwo. In tableOne there is a column called fieldOne and a column called ID. In tableTwo there is a column called fieldTwo and a column called ID.

    I have the value of fieldOne but that is it. I need a single statement that will get the value of ID from the row that fieldOne is in, match the ID with ID in tableTwo and return the value of fieldTwo.

    i hope this makes sense, was quite hard to right out properly. I was thinking of using a join but im not really sure how.

    Many Thanks
    Chris

    #80574
    Bob
    Member

    Wouldn’t that be something like:

    SELECT fieldTwo
    FROM tableTwo
    WHERE tableTwo.ID = tableOne.ID

    I don’t know for sure, my SQL knowledge is a bit rusty. Actually, I only used MSSQL in school a few years ago.

    #80575
    thisishard
    Member

    Thanks for the reply, I just came back to make this thread solved.
    I’m not sure if your code will work but as it turns out you can use a WHERE clause with a JOIN so was pretty simple in the end.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.