Having a table like this:
Table: statuses
ID | status
----|---------
777 | 1
675 | 1
651 | 0
611 | 1
600 | 0
554 | 1
443 | 0
323 | 0
222 | 1
112 | 1
How to select only the rows, where two (or more) statuses in the row are 0? (in the sample case only 443, 323), and group them by the first ID in series.
So the output would be:
ID | status | group
----|--------|---------
443 | 0 | 443
323 | 0 | 443