Click here to Skip to main content
15,881,600 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I am using 2 table one table shows department ID and department name i.e table name is department. where another table contain all employee details with department ID not department name i. e. table is Applicant.
but i want to write a query in second table(applicant) which is have department ID but want to show department name so how to write a left join query?
Posted
Updated 16-Nov-14 23:47pm
v2

As a fresher you have to learn about Joins:

http://www.dotnet-tricks.com/Tutorial/sqlserver/W1aI140312-Different-Types-of-SQL-Joins.html[^]

Types of Join in SQL Server[^]

and then you can create a join Query :)
 
Share this answer
 
Comments
Shweta N Mishra 17-Nov-14 5:50am    
+5
King Fisher 17-Nov-14 5:54am    
Thank you :)
Member 11221185 17-Nov-14 6:14am    
Thanks query solved.
King Fisher 17-Nov-14 6:16am    
Well :)
Try:
SQL
SELECT a.EmpName, d.DeptName FROM Applicant a
JOIN Department d ON a.DeptId=d.ID
 
Share this answer
 

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