Is there a way to select distinct rows from a table using sequelize.js? I looked through the documentation but the "finder methods" do not specify a way to accomplish this task.
You can do the following:
myModel.findAll({
attributes: [[sequelize.fn('DISTINCT', sequelize.col('col_name')), 'alias_name']],
where:{}
}).then(data => {}).....
taken from issues and it works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With