Estou tentando executar uma consulta no Laravel
, no terminal funciona perfeitamente, porém quando insiro no Laravel
, a mesma me retorna vazio, exemplo:
Consulta:
SELECT
MAX(positions.id),
devices.name,
positions.deviceid,
positions.servertime,
positions.devicetime,
positions.fixtime,
positions.latitude,
positions.longitude
FROM positions
INNER JOIN devices
ON positions.deviceid = devices.id
GROUP BY positions.deviceid
no Laravel
:
$ultimasPosicoes = PositionAll::select('SELECT
MAX(positions.id),
devices.name,
positions.deviceid,
positions.servertime,
positions.devicetime,
positions.fixtime,
positions.latitude,
positions.longitude
FROM
positions
INNER JOIN devices ON positions.deviceid = devices.id
GROUP BY
positions.deviceid');
Position.php