【发布时间】:2021-01-30 11:25:12
【问题描述】:
我这里有一个示例代码。
有人可以在不使用knex.raw 的情况下将其翻译成 knex 吗?
SELECT DISTINCT (columna + '-' + columnb) AS column
FROM table
【问题讨论】:
标签: sql node.js distinct concat knexjs
我这里有一个示例代码。
有人可以在不使用knex.raw 的情况下将其翻译成 knex 吗?
SELECT DISTINCT (columna + '-' + columnb) AS column
FROM table
【问题讨论】:
标签: sql node.js distinct concat knexjs
knex 有distinct
const rows = await knex('table').distinct('columna', 'columnb')
rows.map(row => `${columna}-${columnb}`)
【讨论】: