I need to select the most recent record of my Estoque
if the data
column is different, I was able to bring the oldest one when the dates are different:
SELECT codigosuprimento, numeroserie, max(data)
FROM public.estoque where usado = '1' and numeroserie = '1201607048733'
group by codigosuprimento, numeroserie;
But when the column data
is equal, I want it to bring all the records that dates are equal, for example:
Iwouldbringthetwolinessincethedatesarethesame,butwhenso:
It would bring the date 2017-08-18
to be the most current.