-1

Possible Duplicate:
Need a linq to generate itself join

According to this post Why does MYSQL higher LIMIT offset slow the query down? and this article http://explainextended.com/2009/10/23/mysql-order-by-limit-performance-late-row-lookups/ I need a linq to create below query

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
Community
  • 1
  • 1
Ghooti Farangi
  • 19,926
  • 15
  • 46
  • 61

1 Answers1

0

Ok I tried...

var res =
    from item in 
        (from newsItem in news
        where newsItem.cat_id = x
        select newsItem.id).Skip(m).Take(n)

    join other in news
    on other.id equals item.id

    select item
Jan P.
  • 3,261
  • 19
  • 26