how to findOne by min date? #240
Answered
by
ujjwalguptaofficial
crapthings
asked this question in
Q&A
-
db.select({ from: 'Records', order: { by: 'date', type: 'asc' }, limit: 1 }).then(console.log) this doesn't work |
Beta Was this translation helpful? Give feedback.
Answered by
ujjwalguptaofficial
Jul 24, 2021
Replies: 1 comment
-
you can use aggregate for finding minimum value of a column, check this example - https://ujjwalguptaofficial.github.io/idbstudio/?db=Demo&query=select(%7B%0A%20%20%20%20from%3A%20'Orders'%2C%0A%20%20%20%20aggregate%3A%20%7B%0A%20%20%20%20%20%20%20%20min%3A%20'orderDate'%0A%20%20%20%20%7D%0A%7D) here is aggregate docs - https://jsstore.net/tutorial/select/aggregate/ |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
ujjwalguptaofficial
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you can use aggregate for finding minimum value of a column, check this example - https://ujjwalguptaofficial.github.io/idbstudio/?db=Demo&query=select(%7B%0A%20%20%20%20from%3A%20'Orders'%2C%0A%20%20%20%20aggregate%3A%20%7B%0A%20%20%20%20%20%20%20%20min%3A%20'orderDate'%0A%20%20%20%20%7D%0A%7D)
here is aggregate docs - https://jsstore.net/tutorial/select/aggregate/