I'm trying to run a query in Laravel
, the terminal works perfectly, but when I enter in Laravel
, it returns me empty, eg:
Query:
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');