mardi 7 avril 2015

MySQL IF statement checking multiple rows

I am using a MySQL procedure where the result of SELECT * FROM progress where case_id = current_data; is the following table.



+-----------------------------------------------------+
| id_progress | task_id | case_id | user_id | current |
+-----------------------------------------------------+
| 247 | 4 | 1002 | 1 | 0 |
| 248 | 1 | 1002 | 1 | 0 |
| 249 | 2 | 1002 | 1 | 0 |
| 250 | 3 | 1002 | 1 | 0 |
+-----------------------------------------------------+


I wanted to create a IF statement to check the current table. If all rows are equals to '0' or not.


But I have no idea how to proceed. Using a select in the IF statement seems to me strange.


Aucun commentaire:

Enregistrer un commentaire