SELECT id ,MAX(status) AS status FROM Mail WHERE
status < (SELECT status FROM Mail WHERE id = 1000)
GROUP BY status ORDER BY status DESC LIMIT 1;
I am using this query to find the previous row of the current row 1000.Here i am getting NULL values if i use the status column which is not unique.where as it gives proper values if i use unique columns.