Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Simple Query

Author  Topic 

tech1
Starting Member

49 Posts

Posted - 2010-06-09 : 20:12:25
uh, I forgot this!

I have 2 tables and 1 joining table. the joining table has an FK to the 2 tables.

I want to retrieve the values/columns of 1 of the tables, from a parameter supplied to the joining table. how?

Table1:

CountryID
CountryName

Table2:

CultureID
CultureName


Table3 (Joining)

ID
CountryID
CultureID



I need to get a list of cultures (fields being CultureID and CultureName) for a countryID. how can I do this?

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-06-10 : 01:36:29
select t2.CutlureID, t2.CultureName
from table3 as t3
join table2 as t2
on t3.CultureID=t2.CultureId and t3.CountryID=<here_comes_your_value>


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -