solution
不过,我的问题是一样的。我无法转换我的
MySQL
查询到
LINQ
LinqPad
为了它。我已经建立了一个连接。执行我的查询并得到结果。但是
lambda
节为空。
SELECT *
FROM (
SELECT
@row := @row +1 AS rownum, zdjh,sjsj ,xhqd
FROM (
SELECT @row :=0) r, `tj_xhqd` ORDER BY sjsj
) ranked
WHERE rownum % 24= 0 AND zdjh = '002999001180' AND sjsj>='2018-02-24 08:38:11'
林肯
. 型号名称是
kesc
更新1
我试着改变我的
到
.
var mainDetails = kesc.tj_xhqd.Where(m => (m.zdjh == msn) && (m.sjsj >= dt)).AsEnumerable()
.Select((x, i) => new { MSN = x.zdjh, PingDateTime = x.sjsj, PingValue = x.xhqd, i = i })
.Where(x => x.i % interval == 0)
.ToList();
结果是
{
"details": [
{
"MSN": "002999001180",
"PingDateTime": "2018-05-16T18:39:52",
"PingValue": "19",
"i": 0
},
{
"MSN": "002999001180",
"PingDateTime": "2018-05-16T18:39:52",
"PingValue": "19",
"i": 24
},
{
"MSN": "002999001180",
"PingDateTime": "2018-05-16T18:39:52",
"PingValue": "19",
"i": 48
},
{
"MSN": "002999001180",
"PingDateTime": "2018-05-16T18:39:52",
"PingValue": "19",
"i": 72
},
{
"MSN": "002999001180",
"PingDateTime": "2018-05-16T18:39:52",
"PingValue": "19",
"i": 96
},
.
.
.
.
.
{
"MSN": "002999001180",
"PingDateTime": "2018-05-16T18:39:52",
"PingValue": "19",
"i": 144
},
]
}
return Request.CreateResponse(HttpStatusCode.OK, new { details = mainDetails });
2018-05-16T18:39:52
.