Hi,
I have a table where I want the position of a row in a result set that meets an additional condition.
from the listed table above (which is already the result of a JOIN) I want the position of the marked row within the result set (the result set is already orderd by the `time` field).
I looked through the MySQL function reference, but nothing looked like it would do the job, so does anyone know how to do this?
I have a table where I want the position of a row in a result set that meets an additional condition.
Code:
+----+-------+------+ | 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?
Comment