Or maybe:
select b.id, isnull(a.name,b.name) as [Name] from b
left join a on b.[Name] = LEFT(a.[Name],1)
hollystyles
Veteran Poster
1,182 posts since Feb 2005
Reputation Points: 262
Solved Threads: 68
Hmm not really, it replaces the assumption that a.id is a foreign key to b.id.
The OP does not specify. If there is a relation between the id's (which there should be in my opinion, and if the data provided represents all possibilities, then this is indeed the case) your solution is the more efficient.
However if the id's are not related then that only leaves the initial letters, in which case my alternate solution will do.
hollystyles
Veteran Poster
1,182 posts since Feb 2005
Reputation Points: 262
Solved Threads: 68