How do I select a column using an alias

javascript, sequelize.js, sql

Solution

Table.findAll({
  attributes: ['id', ['first', 'firstName']] //id, first AS firstName
})
.then(function(posts) {
  res.json(posts);
});

Problem

How do I perform an sql query such as this? `SELECT column_name AS alias_name FROM table_name;` Example: I want the column 'first' to be selected as 'firstname' ``` Table.findAll({ attributes: [id,"first"] }) .then(function(posts) { res.json(posts); }) ```

Original source

Related problems