I have a table that has 2 columns - date, and result. The result column has values of either 'w' or 'l'. I want to be able order the records by date (desc), find out what the value is for result for the most recent date, then count the number of consecutive values that match that value:

for example:

date result
1/19 w
1/18 w
1/17 w
1/16 l

I would like to return "3" as the value.

Thanks for any help on the subject.

Mason

    1. create the query to return the recordset as you described.
    2. loop through the recordset, incrementing a counter.
    3. stop when the value of result is different to the previous value.

    hth, njm

      I'm assuming that looping through the recordset with a counter is done with php code? I'm not sure how to do this. Any links where I might be able to pick this up?

      Thanks, Mason

        Write a Reply...