Skip to content

SELECT: SUM

Ali Amirnezhad edited this page Jul 23, 2019 · 2 revisions
const query = myQueryBuilder
    .SELECT({ $SUM: 'price' })
    .from('users')
    .get();

// SELECT SUM(`price`) FROM `users`
const query = myQueryBuilder
    .SELECT({ $SUM: { price: 'priceSUM' } })
    .from('users')
    .get();

// SELECT SUM(`price`) AS `priceSUM` FROM `users`
Clone this wiki locally