select top 10 a.ID as a_ID,a.Name as a_Name,c.*
from (select * from DC_Trees where Pid=187 or ID=187 ) a
inner join DC_LibResourceTree b on (','+CAST(a.ID as nvarchar(50))+',')=b.treeval
left join TbLibResource c on c.ID=b.tbpid
where c.audit=0
order by c.AddDateTime desc