How I can write query with Objection.js?
SELECT AVG(field), COUNT(*) FROM tab
Please help me
How I can write query with Objection.js?
SELECT AVG(field), COUNT(*) FROM tab
Please help me
Try this:
const result = await Tab.query().avg(`field`).count(`*`)
console.log(result[0].avg, result[0].count)