我有以下 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))