I have this code in mysql
SELECT * FROM `dev_transacciones`
WHERE `id_transaccion` IN (SELECT MAX(`id_transaccion`)
FROM `dev_transacciones`
GROUP BY `id_producto`)
ORDER BY `id_transaccion` DESC
this displays a table showing the last transaction_id and groups them descending by product_id
And I have this code in php
$data['inventario'] = $this->transaccionesModel
->select('dev_transacciones.*')
->where('id_transaccion', 'IN (SELECT MAX(id_transaccion)')
->groupBy('dev_transacciones.id_producto')
->orderBy('dev_transacciones.id_transaccion desc')
->findAll();
When I use it print($data['inventario'])
shows an empty array
My doubt is how to do the SQL query in PHP, since the php code shows an empty Array, it does not show it like the second image that I added
The first image is the normal table and the second one is with the sql query