Wednesday, March 7, 2012

How to get name which has id ?

hi,
This is my table structure ,

Table 1 :
first_Id Count
Emp1000 10
Emp1001 5

Table 2:
Second_id Name
Emp1000 John
Emp1001 Raj

Now my output should be .

Name Count

John 10
Raj 5

How to write the query ?hi,

use inner join.. like
select y.name, x.count from [table 1] x inner join [table 2] y on x.first_id = y.second_id

see "joins" on BOL..

-clintz|||I think that this was more fully explored and answered in your other post. Check here.

No comments:

Post a Comment