Get a Quote Right Now

Edit Template

Adding LIMIT expression

Adding a LIMIT expression is easy as:

createQueryBuilder("user").limit(10)

Which will produce the following SQL query:

SELECT ... FROM users user LIMIT 10

The resulting SQL query depends on the type of database (SQL, mySQL, Postgres, etc). Note: LIMIT may not work as you may expect if you are using complex queries with joins or subqueries. If you are using pagination, it’s recommended to use take instead.

Share

Leave a Reply

Your email address will not be published. Required fields are marked *