order by parent child sequelize code example
Example: sequelize 4 sort on joined table attribute
Customer.findAll({
order: '"Orders"."orderDate" DESC',
include: [Order]
}, {
raw: true
}).then(function(data) {
console.log(data);
});
// Generated order by clause
// ORDER BY "Orders"."orderDate" DESC;