How to convert paged query to custom query

I try to convert because the paged query doesn’t work with my case for two reasons:

  1. Wappler don’t create the correct query (it try to do an ON of an inner join on a table instead of a field)

  2. I need to use ILIKE

    SELECT a
    FROM t
    WHERE b = :P1
    ORDER BY :P2 :P3
    LIMIT :P4
    OFFSET :P5

This query doesn’t work as it throw an error for :P3

SELECT a
FROM t
WHERE b = :P1
ORDER BY :P2 DESC
LIMIT :P4
OFFSET :P5

This work though, I guess it’s because as :P3 is a string when query is prepared the query looks like

ORDER BY "b" "DESC" instead of ORDER BY "b" DESC

Community Page
Last updated: