C# EntitySpaces中相对复杂的查询返回的结果与实际执行时不同 我有一个相对复杂的SQL查询来为我在工作中维护的应用程序选择新特性的一些数据。这是问题所在 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' ) ) 选择pchtq.[sourceappid], pchtq.[transactioncode], pchtq.[accountid], pchtq【年份】, pchtq.[filingdatetime], pchtq【金额】, pchtq.[注], pchtq.状态, pchtq.SourceRecordID, utaq.fullname, utaq.username 来自[database].[dbo].[transactions1]pchtq 内部联接[database].[dbo].[useraccounts]utaq 在pchtq上。[accountid]=utaq。[accountid] 哪里 pchtq.status='失败' 和pchtq。[recordcreatedatetime]>='01/01/2015' 和pchtq。[recordcreatedatetime]=request.StartDate &&pchtq.RecordCreateDateTime
可能是因为您使用的字符串大小写不同?“失败”与“失败”以及“审核”与“审核”C# EntitySpaces中相对复杂的查询返回的结果与实际执行时不同 我有一个相对复杂的SQL查询来为我在工作中维护的应用程序选择新特性的一些数据。这是问题所在 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' ) ) 选择pchtq.[sourceappid], pchtq.[transactioncode], pchtq.[accountid], pchtq【年份】, pchtq.[filingdatetime], pchtq【金额】, pchtq.[注], pchtq.状态, pchtq.SourceRecordID, utaq.fullname, utaq.username 来自[database].[dbo].[transactions1]pchtq 内部联接[database].[dbo].[useraccounts]utaq 在pchtq上。[accountid]=utaq。[accountid] 哪里 pchtq.status='失败' 和pchtq。[recordcreatedatetime]>='01/01/2015' 和pchtq。[recordcreatedatetime]=request.StartDate &&pchtq.RecordCreateDateTime,c#,sql-server,entityspaces,C#,Sql Server,Entityspaces,可能是因为您使用的字符串大小写不同?“失败”与“失败”以及“审核”与“审核” 老实说,这是我所能看到的唯一区别。也许是因为您使用的字符串在大小写上有所不同?“失败”与“失败”以及“审核”与“审核” 老实说,这是我能看到的唯一区别 pchtq .Select( pchtq.SourceAppID, pchtq.TransactionCode, pchtq.AccountID, pchtq.Year, pchtq
老实说,这是我所能看到的唯一区别。也许是因为您使用的字符串在大小写上有所不同?“失败”与“失败”以及“审核”与“审核” 老实说,这是我能看到的唯一区别
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));