MergeTable Queryable cannot Take Skip OrderBy PageToList 返回

求助
3 170

           想要实现以下的SQL,但是却出现错误:MergeTable  Queryable cannot Take Skip OrderBy PageToList

            

             /*
            string sql = " Select Distinct(SID) from(" +
                         " Select *, ROW_NUMBER() Over (Partition By SID Order By TDate Desc, TradeSN desc) As Sort" +
                         " from TradeRecord Where TDate <= @TDate)A Where A.Sort = 1 and A.HoldNum != 0";
            */

 

            return sqlClient.Queryable<TradeRecord>()
                            .PartitionBy(it => it.SID)
                            .Where(it => SqlFunc.ToDate(it.TDate) <= SqlFunc.ToDate("2018/01/01"))
                            .OrderBy(it => it.TDate, OrderByType.Desc)
                            .OrderBy(it => it.TradeSN, OrderByType.Desc)
                            .Take(1)
                            .Select(it=>it)
                            .MergeTable()
                            .Where(it=>it.HoldNum!=0)
                            .Select(it => it.SID).ToList();

热忱回答3

版块

学习文档

最新会员

发布达人

回贴达人