I have a table where I want the position of a row in a result set that meets an additional condition.
Expand|Select|Wrap|Line Numbers
- +----+-------+------+
- | ID | valid | time |
- +----+-------+------+
- | 1 | 0 | 1:00 |
- | 2 | 0 | 2:00 |
- | 18 | 0 | 3:00 |
- | 24 | 0 | 3:30 |
- | 39 | 1 | 3:55 | <-- need that position where `valid` = 1, i.e. "5"
- | 46 | 0 | 7:00 |
- +----+-------+------+
I looked through the MySQL function reference, but nothing looked like it would do the job, so does anyone know how to do this?