Skip to content

Retrieve random rows from Postgresql DB #5515

Closed Answered by B4nan
SeRiice asked this question in Q&A
Discussion options

You must be logged in to vote

orderBy: raw("RANDOM()"),

This needs to be an object, keys map to property names and values to the order (asc/desc). Try orderBy: { [raw("RANDOM()")]: 'asc' }.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@SeRiice
Comment options

Answer selected by SeRiice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants