declare @TypeName varchar(50) set @TypeName='类型' select count(*) from tableB a join (select TypeId from tableC where TypeName like @TypeName+'%') b on a.TypeId=b.TypeId
select count(1) from tablec a inner join tableB b on a.TypeId = b.TypeId where a.TypeName like'%xxx%'
select b.Id,b.TypeId,c.TypeName,(select count(*) from tableB b,tableC c where c.TypeId=b.TypeId where c.TypeName like '%类型%') s from tableB b,tableC c where c.TypeId=b.TypeId and c.TypeName like '%类型%'
from tableB b,tableC c where c.TypeId=b.TypeId and c.TypeName like '%类型%'