user6504610
user6504610

Reputation:

Get values from multiple sql server table by one query

I have three tables as following: enter image description here

I want to select values of (userid from tbladmin) and (compname from tblcompany)

Basically userid is the username name and compname is the company name. I want the name of the company/companies the user is affiliated to.

Hoping for answer.

Upvotes: 0

Views: 43

Answers (1)

George Menoutis
George Menoutis

Reputation: 7240

Join these tables:

select a.userid,c.compname
from tbladmin a
inner join userrights r on a.id=r.id
inner join tblcompany c on r.compid=c.compid

Upvotes: 2

Related Questions