LINQ查询语法操作数应包含1列

时间:2018-11-21 18:09:38

标签: mysql linq linqpad linq-query-syntax

我有以下LINQ代码:

var count = (from ad in AccelerometerData
         join ae in AccelerometerEvents on ad.AccelerometerDataId equals ae.AccelerometerData.AccelerometerDataId
         where ad.Device.DeviceId == journey.Device.DeviceId && ae.TimeStamp >= journey.StartDateTime && ae.TimeStamp <= journey.EndDateTime
         select ae).Count();

当我运行代码时,它给了我错误:

  

MySQL-操作数应包含1列

我正在使用MySQL驱动程序在LINQPad中运行代码。在将它放入应用程序之前,我正在LINQPad中对其进行测试。

从LINQPad生成的SQL看起来像这样:

SELECT COUNT(*)
FROM AccelerometerData AS t0
INNER JOIN AccelerometerEvent AS t1
  ON (t0.AccelerometerDataId = (
    SELECT t3.AccelerometerDataId, t3.DeviceId, t3.PacketId, t3.ReceivedDateTime, t3.StartDateTime
    FROM AccelerometerData AS t3
    WHERE (t3.AccelerometerDataId = t1.AccelerometerDataId)))
LEFT OUTER JOIN Device AS t2
  ON (t2.DeviceId = t0.DeviceId)
WHERE (((t2.DeviceId = 103) AND (t1.TimeStamp >= @p0)) AND (t1.TimeStamp <= @p1))

0 个答案:

没有答案