I am trying to create a statement that returns a field from a date, but under a certain condition.
First of all I have a table with several fields, among which I am interested in the following image:
What I need is for you to return the last record entered by date.
Ex: Search criteria 2018-02-28 Returns the CLIENT ID 4 .
Ex: Search criteria 2018-03-04 Returns the CLIENT ID 2 .
Ex: Search criteria 2018-02-15 does not return anything.
So far I have the following code:
SELECT 'cliente' FROM 'Historial' WHERE 'fecha' LIKE '%$busqueda%' GROUP BY 'cliente' ORDER BY 'fecha' DESC
Where $ search comes to be the date.
I would appreciate any help. Thank you very much.