• what is the date column on the levels table called then ? you didn't post the table structure so we can't really help

    but you need to change @reading date to be the date column in levels table

    MVDBA