I have a basis that I need one of the columns to be the search for the lowest date registered in that CPF / CNPJ at the base.
In the example would create the column data_anterior
:
cpf_cnpj | aplicado| data_aplic | data_anterior ------------------------------------------------- 123456789 | sim | 22/03/2018 | missing 123456789 não | missing | 22/03/2018
When the date is the same as data_aplic
, the information should not appear.
Can you help me to schedule this function in SQL
?