4
I need to value the inventory of the company I work for and for that I will take the last value of the items. I was using the MAX, but I realized that if I did this, it would return me the highest price and not the last registered in the table. So I changed the MAX for the date column, only it brings me several rows of results, and I need only the last but still with the code field and value to then play in a spreadsheet. 
Code:
SELECT irec.pro_in_codigo Codigo,
       irec.rci_re_vlunitario Valor_unitario,
       max(irec.rcb_dt_documento) Data    
FROM mgadm.est_itensreceb irec    
WHERE irec.pro_in_codigo = 701    
GROUP BY irec.pro_in_codigo, irec.rci_re_vlunitario
You want to get the last record of the table?
– JcSaint