LINQ query syntax Operand should contain 1 column(s)

50 views Asked by At

I have the following LINQ code:

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();

When I run the code, it gives me the error:

MySQL - Operand should contain 1 column(s)

I am running the code in LINQPad with MySQL Driver. I am testing it in LINQPad before putting it in my application.

The SQL Generated from LINQPad looks like this:

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

There are 0 answers