1
I have the balance table, that always when running a precedent, It is generated a new record in the same, You can have several record in the same day... However, when making a query, I want to bring only the last record of each day, so I did so:
DELIMITER //
CREATE PROCEDURE pro_get_balanco_diario(IN var_data DATETIME)
BEGIN
SELECT *
FROM saldo
WHERE DATE(data_mov_saldo) = var_data
ORDER BY data_mov_saldo DESC
LIMIT 1;
END //
However, now I need to do this query bringing the data between a date range, that is, bring the data between an initial date and a final date, but bringing only the last record of each day, as in the above process.
The table fields are shown in the image.
has already solved your problem ?
– Marco Souza