摘要: 尽量避免在 where 子句中使用 or 来连接条件,否则将导致引擎放弃使用索引而进行全表扫描,如: select id from t where num=10 or num=20 可以这样查询: select id from t where num=10 union all select id f 阅读全文
posted @ 2021-11-02 11:19 没有狐狸的南墙 阅读(23) 评论(0) 推荐(0) 编辑
摘要: select top 10 * From A outer apply (select top 1 * from B where A.ID=B.ID order by A.DATETIME desc) as B 关键 处( outer apply ) 阅读全文
posted @ 2021-11-02 11:12 没有狐狸的南墙 阅读(121) 评论(0) 推荐(0) 编辑