SELECT
tr3.TimeStart,
tr1.Price as PriceStart,
tr2.Price as PriceFinish,
tr3.PriceHigh,
tr3.PriceLow,
tr3.Volume
FROM TradeFill as tr1,
TradeFill as tr2, (
SELECT
FLOOR(UNIX_TIMESTAMP(t1.TimeAdded)/(1 * 1 * 1 * 1)) AS timekey,
min(t1.Id) as min_id,
max(t1.Id) as max_id,
min(t1.TimeAdded) as TimeStart,
max(t1.TimeAdded) as t_max,
min(t1.Price) as PriceLow,
max(t1.Price) as PriceHigh,
SUM(t1.Quantity) as Volume
FROM
TradeFill as t1
WHERE t1.TimeAdded BETWEEN "2018-01-01 00:00:00" AND "2018-08-10 23:59:59"
GROUP BY timekey
) as tr3
WHERE tr1.Id = tr3.min_id
AND tr2.Id = tr3.max_id
Пробую так:
var tradeFill = DbContext.TradeFill.FromSql(query).ToList();
Выдает ошибку
The required column 'Id' was not present in the results of a 'FromSql' operation
В TradeFill нет данных полей которые в SELECT
Как можно просто выполнить данный запрос или может как-то переписать в LINQ
The required column 'Id' was not present in the results of a 'FromSql' operation
- как то пробовали решить эту проблему?