4
I have a question. I believe it is nothing complex, but I could not solve.
For example, I have this query:
select * from Paciente where ClinicaID = 3
Your result would be these 3 records:
NomePaciente HoraAtendimento Ativo ClinicaID
Teste2 9:30:00 FALSE 3
Teste3 9:00:00 TRUE 3
Teste4 9:00:00 TRUE 3
I need a query to return the lines to my system only if all the lines are Active = true, so if you have any false lines, will not return me any line.
So: If all lines are true in my query, return all lines. If you have any false ones, you should not return any.
Evandro’s answer is simple and as precise as possible, the filter for the active field returns only the ones you want.
– Brewerton Santos
@Thiagooliveira, simple but wrong. Look at @Josédiz’s reply, it is fully correct and also shows graphically that it is correct. If by chance the clinic has a patient with
ativo = 'FALSE'
, then does not display a line. Otherwise, if all lines are marked withativo = 'TRUE'
, then returns all lines– Jefferson Quesado