Previous record Mysql

1

Hello, I'm trying to see the previous record in relation to the current record. I am using the following code

SELECT * FROM Tabela WHERE compoid <"Contraband" ORDER BY compoid DESC LIMIT 1;

But it is returning the blank table What's wrong? How can I search the previous record using select in mysql

    
asked by anonymous 27.03.2015 / 22:38

1 answer

1

I tested it and got it right below it takes the penultimate record of the table

SELECT max(compoid)-1, t.* FROM Tabela t ORDER BY compoid DESC LIMIT 1;
    
10.04.2015 / 21:45