根据这篇文章为什么 MYSQL 较高的 LIMIT 偏移量会减慢查询速度? https://stackoverflow.com/questions/4481388/why-does-mysql-higher-limit-offset-slow-the-query-down和这篇文章http://explainextend.com/2009/10/23/mysql-order-by-limit-performance-late-row-lookups/ http://explainextended.com/2009/10/23/mysql-order-by-limit-performance-late-row-lookups/我需要一个 linq 来创建以下查询
SELECT news.*
FROM (
SELECT id
FROM news
WHERE cat_id= x
ORDER BY
id DESC
LIMIT m, n
) o
JOIN news
ON news.id = o.id
这应该可以做到。 (跳过/接受等于限制)
from u in news
join n in
(
from x in news
where x.cat_id = 10
orderby x.Id descending
select x
).Skip(10).Take(20) on u.Id equals n.Id
select u
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)