I need to group by date a table with several dates with a specific value for each date. For example:
01/01/2016 10
01/01/2016 20
01/01/2016 30
02/01/2016 40
02/01/2016 50
...
The result should be:
01/01/2016 10 20 30
02/01/2016 40 50
This I have to get in a PostgreSQL table that I manage with Sequelize and NodeJS .
var options = {
where: {mes: req.body.resumen.mes, any: req.body.resumen.any},
group: 'dia',
order: [
['fecha', 'ASC']
]
};
models.Lectura.findAll(options).then(function(lecturas) {
res.render('lecturas/resumen', {lecturas: lecturas, errors: []});
}).catch(function(error){next(error)});
When I read about readings, I only get the last one from each group, something like this:
01/01/2016 30
02/01/2016 50
How could I solve it?