【发布时间】:2019-12-11 16:46:22
【问题描述】:
这是我的示例代码,我的问题是如何在查询中将“cityName”设为别名
const test = await test.findAll({
where: { cityName: { $like: '%' + searchWord + '%' } },
attributes: ['a', 'b']
})
对不起我的英语水平 这是我的补充说明,我想用参数来代替'cityName'
let NewCityName = 'something'
const test = await test.findAll({
where: { NewCityName: { $like: '%' + searchWord + '%' } },
attributes: ['a', 'b']
})
这段代码不起作用,但它似乎有助于理解问题。
【问题讨论】:
标签: sql node.js sequelize.js