Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi all

I have two tables in that
1) TechnologyMaster
TechnologyId(PK) int
TechnologyName varchar

2)Title Master
TitleId(PK) int
ProjectTitle varchar
TechnologyId(FK) int
DomainId(FK) int

I want all projecttitle and technologyname how to write join query. please help me
Posted
Comments
Corporal Agarn 2-Nov-12 8:54am    
What do you have so far?
Lakshmimsridhar 2-Nov-12 8:54am    
didnt get u??

SQL
SELECT tim.ProjectTitle, tem.TechnologyName 
FROM dbo.TitleMaster tim
         INNER JOIN
     dbo.TechnologyMaster tem
         ON tim.TechnologyId = tem.TechnologyId
--WHERE: Add an optional where clause here if you need one


Please also refer to this: http://www.w3schools.com/sql/sql_join_inner.asp[^] or this Using Inner Joins[^].

Regards,

— Manfred
 
Share this answer
 
v4
SQL
SELECT Tech.TechnologyName, Tm.ProjectTitle
FROM TechnologyMaster Tech
         INNER JOIN
     Titlemaster Tm
         ON Tech.TechnologyId = Tm.TechnologyId
 
Share this answer
 
v2
This seems like a fairly simple join, so I'm going to assume you aren't familiar with joins. To join two tables, you need to connect them based upon a common value. In this case, the TechnologyId field contains the values that are equal (the number represents a row in the TechnologyMaster table). Now we need to make an assumption: do we want all the records from one table and the values from the other table that match or do we want only the rows that match on both sides. For instance, if we have a record in the TechnologyMaster table that doesn't have a corresponding row (or rows) in the Title Master table, do we want that row from TechnologyMaster to show? The same is true in reverse (although it is less likely since the TitleMaster table seems to be dependent on the TechnologyMaster table). I will assume we want the rows where there is a match on both sides. This is called an INNER JOIN and it is the most common type of join. Here is how we would do this:
SQL
SELECT te.TechnologyName, ti.ProjectTitle
FROM TechnoloogyMaster te
INNER JOIN TitleMaster ti ON te.TechnologyId = ti.TechnologyId

Note that I renamed the tables to make them shorter (te instead of TechnologyMaster and ti instead of TitleMaster). This is just to simplify things.
 
Share this answer
 
Comments
Lakshmimsridhar 2-Nov-12 9:15am    
ok thanks

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