[英]Idaeablade PassthruEsqlQuery returns empty list
我有兩個查詢應該執行相同的工作:
1。
var date = DateTime.
var q = _entityManager.Websites.Include("OfflineSites")
.Where(website => (website.LastCheck == null) || SqlFunctions.DateDiff("minute", website.LastCheck.Value, date) >= website.CurrentPingTime);
q.QueryStrategy = QueryStrategy.DataSourceOnly;
var lst = q.Execute().Cast<Website>().ToList();
2。
var query = new PassthruEsqlQuery(typeof(Website), @"Select * From Websites Where Id in (Select Id From (Select Id,CurrentPingTime,Abs(DateDiff(minute,CURRENT_TIMESTAMP,LastCheck)) LastCheckDiffNow From Websites )
as ret Where CurrentPingTime <= LastCheckDiffNow)");
query.QueryStrategy = QueryStrategy.DataSourceOnly;
var result = query.With(_entityManager).Execute().Cast<Website>();
var lst = result.ToList()
但是第一個像魅力一樣工作,但速度較慢,第二個返回空列表。 這很奇怪,因為我已經檢查了SSMS中的sql代碼,並提供了良好的結果。 可能是這種行為的原因。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.