Put a new line inside you code tags (which is a good idea in general, for readability)
select a.*, (select max(Startdate)
from @b-2 b
where b.id=a.id and b.StartDate <=a.StartDate) StartDateB
from @a a
And be careful, that's likely going to be horrifically slow on anything more than a handful of rows
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability