Tim*_*ney 11 javascript sql sequelize.js
我如何执行这样的SQL查询?
SELECT column_name AS alias_name FROM table_name;
示例:我希望将"first"列选为"firstname"
Table.findAll({
attributes: [id,"first"]
})
.then(function(posts) {
res.json(posts);
})
Run Code Online (Sandbox Code Playgroud)
Jan*_*ier 33
Table.findAll({
attributes: ['id', ['first', 'firstName']] //id, first AS firstName
})
.then(function(posts) {
res.json(posts);
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12666 次 |
| 最近记录: |