Skip to content

SELECT: LPAD

Ali Amirnezhad edited this page Jul 24, 2019 · 1 revision
const query = myQueryBuilder
    .SELECT({ $LPAD: 'field', $ARGS: [10, '$string'] })
    .from('table')
    .get();

// SELECT LPAD(`field`, 10, 'string') FROM `table`
const query = myQueryBuilder
    .SELECT({ $LPAD: 'name', $ARGS: [10, '$ '] })
    .from('table')
    .get();

// SELECT LPAD(`name`, 10, ' ') FROM `table`
const query = myQueryBuilder
    .SELECT({ $LPAD: { field: 'fieldLPAD' }, $ARGS: [10, '$string'] })
    .from('table')
    .get();

// SELECT LPAD(`field`, 10, 'string') AS `fieldLPAD` FROM `table`
const query = myQueryBuilder
    .SELECT({ $LPAD: { name: 'nameLPAD' }, $ARGS: [10, '$ '] })
    .from('table')
    .get();

// SELECT LPAD(`name`, 10, ' ') AS `nameLPAD` FROM `table`
Clone this wiki locally