I have a question with a mysql query.
What I need to get are the nombres
that have only the estado
= 1
. As you can see in the table, the nombre
"pepe" has status "1 and 0", is there any way to exclude it?
tabla personas
id |estado|nombre
1 | 1 |pepe
2 | 0 |pepe
3 | 1 |juan
4 | 1 |diego
5 | 0 |alex
What I have is this
SELECT
*
FROM
personas
WHERE
estado in (SELECT
DISTINCT estado
FROM
personas
WHERE estado = 1)
but it shows me all those who have been 1 .. and I can not exclude those who have 0 and 1, I hope it is understood, thanks