I have the following sql query:
select nome, data, situacao from cadastro
The result is like this:
MARIA 01/01/2018 0
MARIA 15/01/2018 1
GISELE 15/01/2018 0
CICERA 08/01/2018 1
ANTONIA 20/01/2018 0
ANTONIA 15/01/2018 1
I need to make a distinct by name:
select distinct(nome), data, situacao from cadastro group by data, situacao
The problem is that it does not make the distinct because the dates are different, however, I need that, when the patient has two tokens (situation 0 and 1), only the listing with situation = 1 is listed. >
In this case, you should generate the result like this:
MARIA 15/01/2018 1
GISELE 15/01/2018 0
CICERA 08/01/2018 1
ANTONIA 15/01/2018 1
Any suggestions?