摘要:
Left Join B表,只取B表一条记录 --用OUTER APPLY select b.* FROM a表 a OUTER APPLY (select TOP(1) * from b表 WHERE [Name] = a.[AName] ORDER BY BNo desc) b 总结: 1. 理解 阅读全文
摘要:
这个查询在【用xxId和Parent_xxId存储的树】的表中,用的比较多。 每次都记不住,记录一下。 with t as ( select level=1,* from GuPiaoGaiNian where GaiNianID = 'G000542' union all select level 阅读全文