首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >EntitySpaces中相对复杂的查询返回的结果与实际执行时的结果不同

EntitySpaces中相对复杂的查询返回的结果与实际执行时的结果不同
EN

Stack Overflow用户
提问于 2016-05-12 00:07:54
回答 1查看 112关注 0票数 1

我有(我认为是)一个相对复杂的SQL查询来为我在工作中维护的一个应用程序的新功能选择一些数据。下面是查询。

代码语言:javascript
复制
 SELECT pchtq.[sourceappid], 
       pchtq.[transactioncode], 
       pchtq.[accountid], 
       pchtq.[year], 
       pchtq.[filingdatetime], 
       pchtq.[amount], 
       pchtq.[note], 
       pchtq.Status,
       pchtq.SourceRecordID,
       utaq.fullname, 
       utaq.username 
FROM   [database].[dbo].[transactions1] pchtq 
       INNER JOIN [database].[dbo].[useraccounts] utaq 
               ON pchtq.[accountid] = utaq.[accountid] 
WHERE  
         pchtq.status = 'failed' 
         AND pchtq.[recordcreatedatetime] >= '01/01/2015' 
         AND pchtq.[recordcreatedatetime] <= '05/11/2016' 
         and Not exists 
         (
                select TransactionID
                from
                    Database.dbo.Transactions2 eft
                where
                    CAST(eft.TransactionID as nvarchar(50)) = pchtq.SourceRecordID
                    and eft.status IN( 'paid', 'audit' )
         )

在实体空间中,我把它写成这样:

代码语言:javascript
复制
pchtq
    .Select(
        pchtq.SourceAppID,
        pchtq.TransactionCode,
        pchtq.AccountID,
        pchtq.Year,
        pchtq.FilingDateTime,
        pchtq.Amount,
        pchtq.Note
        ).InnerJoin(utaq).On(pchtq.AccountID == utaq.AccountID)
        .Where(pchtq.RecordCreateDateTime >= request.StartDate
            && pchtq.RecordCreateDateTime <= request.EndDate
            && pchtq.Status == "FAILED")
        .NotExists(
            eftq.Select(
                eftq.EFileTransactionID
                ).Where(eftq.Status.In("Paid", "Audit") 
                        && Convert.ToString(eftq.TransactionID) == pchtq.SourceRecordID));

然而,当我在ES应用程序中运行它(使用pchtc.Load(pchtq))时,我得到了大约7500行,而当我运行SQL查询时,我得到了大约1500行。

这里出了什么问题?

EN

回答 1

Stack Overflow用户

发布于 2016-05-12 01:09:50

也许是因为你的字符串大小写不同?“失败”vs“失败”和“审计”vs“审计”?

老实说,这是我能看到的唯一区别。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37167975

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档