Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple But It's Late 1

Status
Not open for further replies.

JurkMonkey

Programmer
Nov 23, 2004
1,731
CA
I have a table which simply contains UserID and BuildingID.

I need to pull the data from the Building table using the results of a specific userid in the first table.


Users
ID Name
1 Timmy
2 Billy
3 Joe

Building
ID Address
1 123 Main St
2 456 Water Rd

MyTable
ID UserID BuildingID
1 2 2

I would expect to return Billy 456 Water Rd.

Someone got some SQL for me? :)

Thanks
 
Code:
select Users.Name
     , Building.Address
  from MyTable
inner
  join Users
    on Users.ID = MyTable.UserID
inner
  join Building
    on Building.ID = MyTable.BuildingID

r937.com | rudy.ca
 
Thanks!

P.S. Your business is located about 10 minutes from where I live. ;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top