• What version of SQL Server are you using?

    I am not sure is you are looking for the last non-zero value or the maximum non-zero value. Anyway, filter the rows to get just rows with [ReadNo] greater than zero and then enumerate them in descendent order by DateCreated.

    with R as (

    select *, row_number() over(partition by DeviceNo order by DateCreated DESC) as rn

    from T

    where ReadNo > 0

    )

    select DeviceNo, ReadNo

    from R

    where rn = 1;