Click here to Skip to main content
15,115,146 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Select a.College_Name,
b.authoritites_Name,b.authoritites_Designation,b.authoritites_Contact
,c.Squads_Name
FROM Tbl_Anti_Ragging1 a Inner Join Tbl_Anti_Ragging2 b on a.CollegeId=b.CollegeId
Inner Join Tbl_Anti_Ragging3 c on a.CollegeId=c.CollegeId
Inner Join Tbl_Anti_Ragging4 d on d.CollegeId=a.CollegeId



Select * from Tbl_Anti_Ragging1
Select*from Tbl_Anti_Ragging2
Select* from Tbl_Anti_Ragging3
Select* from Tbl_Anti_Ragging4

What I have tried:

Above is my Code First Table in my Single Row ,Second Table have 2 row,third table have 2 row,fourth table have 2 row but when i using inner join then it create 8 row i want know
how to make query means my row will make only 2 row

so please help me
Posted
Updated 28-Mar-17 0:23am
Comments
F-ES Sitecore 28-Mar-17 4:07am
   
Post the data, or examples of it, and the desired output. It might just be a case of adding distinct so "select distinct" rather than just "select" but without seeing the data it's impossible to know.

1 solution

Use distinct key word to select the record in one row.
It can show one row if the relationship between the tables in one to one.

Select distinct a.College_Name, b.authoritites_Name, b.authoritites_Designation, b.authoritites_Contact, c.Squads_Name
FROM Tbl_Anti_Ragging1 a Inner Join Tbl_Anti_Ragging2 b on a.CollegeId=b.CollegeId
Inner Join Tbl_Anti_Ragging3 c on a.CollegeId=c.CollegeId
Inner Join Tbl_Anti_Ragging4 d on d.CollegeId=a.CollegeId.

Check this query it may help you.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900