Query pagination with LIKE function

0

Good afternoon. I am having an error in the query with pagination when I pass a search parameter. Here's the problem: When I'm on page 2 and search for an item on page 20 my sql does not return anything. Follow sql :

SELECT *
  FROM tabela
 WHERE UPPER(name) LIKE UPPER(‘%cadern%’)
 LIMIT 10
OFFSET (2 - 1) * 10

This LIKE returns two lines, but OFFSET is to return from line 10 so it always comes empty.

Has anyone ever had this problem?

    
asked by anonymous 30.11.2018 / 17:12

0 answers