How to make a query to get random() rows with limit of 3 rows?
I tried but get error:
myQueryBuilder.orderBy("random()", true);
How to make a query to get random() rows with limit of 3 rows?
I tried but get error:
myQueryBuilder.orderBy("random()", true);
I solved it by using the orderByRaw(...)
method:
myQueryBuilder.orderByRaw("RANDOM()");
© 2022 - 2024 — McMap. All rights reserved.