Hello I was trying to do this...
When my query returns 0, 1 or 2 do different things.
SELECT status FROM event_auth WHERE perm = true AND id_event = 1
and it returns
status
--------
0
0
2
then I did it
SELECT status FROM event_auth WHERE perm = true AND id_event = 1 GROUP BY status
status
--------
0
2
It might be more than 3 rows, I just want to get those rows. I want to check this... Php Code... (explaning)
if ( (rows == 1) == 1){
// do something
}
if ( (rows => 1) == 0){
// do something
}
if ( rows > 1 ) == 2{
//do something
}
if
I have an authorize movements module where
0 = pending,
1 = accepted,
2 = rejected.
if all my authorizer are in 0 or one of them is 0, don't do anything.
if one of them put 2, reject it.
if all them put 1, do something... (change an status in another table)
Exist something that I can do ?
Thank you.
0s,1s and2s you have?COUNT()is the answer:SELECT status, COUNT(*) FROM event_auth WHERE... GROUP BY statuswhich reports the number of rows per status.