Skip to Content (Press Enter)
OutSystems.com
Personal Edition
Community
Support
Training
Training
Online Training
Developer Schools
Boot Camps
Certifications
Tech Talks
Documentation
Documentation
Overview
ODC
O11
Forums
Forge
Get Involved
Get Involved
Jobs
Ideas
Members
Mentorship
User Groups
Platform
Platform
ODC
O11
Search in OutSystems
Log in
Get Started
Back to Forums
Pedro Coelho
MVP
8
Views
1
Comments
Limit and Offset on Queries
Question
Hello
I'm currently working in a project where the client has some web services running on a Postgres DB and wants to mimic the Postgres LIMIT behaviour in our app.
I could do something like:
SELECT * FROM (
SELECT TOP x * FROM (
SELECT TOP y <fields>
FROM table
WHERE <conditions>
ORDER BY table.field ASC) as t2
ORDER by field DESC) as t1
ORDER by field ASC
where x is the number of rows you want returned and y is x+offset.
This extra nesting should add some load to the query, but not much I believe...
Is there a "smarter" way of doing this in OutSystems?
Best regards,
PC
J.
MVP
Not sure if there is a smarter way for it.
depending on the real situation and how often it changes.
will give you some suggestions.
(1. use only the inner sql, and do a for-each loop and solve the X on that way (duplicating the list))
2. use only the inner sql, place it in table and set the startindex X and go from there
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
See the full guidelines
Loading...