Thursday 28 March 2013

SQL Server Retrieve Data from Multiple Tables Using Inner Joins

SQL Server Retrieve Data from Multiple Tables Using Inner Joins

In this article i will tell you how you can retrieve data from multiple table from sql server by using inner join. 


Prepare the table two table for demo purpose.

compnay table

In this i have defined added the company id by user.
 
User login table

Inner join is the join in which if record is matched only that case record will return. 

Now use the below query to retrieve the record. 

select U.Id,U.UserId,U.Name,C.CompnayName from UserLogin U
inner join CompanyName C on U.CompanyId=C.Id


Now run the query and check the output.

inner join

No comments:

Post a Comment