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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Select Query
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Yak Posting Veteran

52 Posts

Posted - 11/07/2013 :  04:31:55  Show Profile  Reply with Quote
i have Two table

1) Country

ID Name
----- ---------
123 UK
456 US
789 SF


Did DName Description CountryID
------- -------- ------------ -----------
111 Test Sample 123
222 TTest SSample 789

i need to retrive the value from Document table.

Select CountryID from Document where Did = 111

The above query return Country id , but i need to return Country Name

Excepted O/p --> UK

Please help


Very Important crosS Applying yaK Herder

52326 Posts

Posted - 11/07/2013 :  04:38:01  Show Profile  Reply with Quote
just a simple join

FROM Country c
INNER JOIN Document d
ON d.CountryID = c.ID
WHERE Did = 111

SQL Server MVP
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000