如何执行这样的 sql 查询?
SELECT column_name AS alias_name FROM table_name;
示例:我希望将“first”列选为“firstname”
Table.findAll({
attributes: [id,"first"]
})
.then(function(posts) {
res.json(posts);
})
最佳答案
Table.findAll({
attributes: ['id', ['first', 'firstName']] //id, first AS firstName
})
.then(function(posts) {
res.json(posts);
});
关于javascript - 如何使用别名选择列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32649218/