Skip to content
Advertisement

How to sort by pagerequest with inner join

I have two tables with many to one realtion. I want to sort data in table “user” by column “street” that is in “address” table in ASC or DESC direction defined by request param:

When I execute sql script:

in workbench or phpMyAdmin it works good. All data are sorted by street name;

But when i try get it in postman by:

I have this error in console output:

Where is problem?

Also when i wrote query in repository like this it works as good as in workbench:

But i want to have controll of request and sort data when i want (using sort param).

Advertisement

Answer

Try replacing the SQL to SELECT u, a FROM user u INNER JOIN u.address a ORDER BY street DESC

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement