I use sequelize on my nodeJS app to query a sql database.
I try to sequelize this query but it doesn't work...
Can one help me ?
`SELECT content, COUNT(*) count FROM `hashtags` GROUP BY content ORDER BY count DESC LIMIT 10`
I try
Tags.findAll({group: ['content'], attributes: ['content', [sequelize.fn('COUNT', 'content'), 'content']],}).then(function(results) {
Tags is a sequelize define with date, content, id_tweet, id.
I have another query but I don't have any idea to do this because there are 2 inner join and count:
SELECT COUNT(*) AS nombredetweets, h.content, u.pseudo FROM tweets t INNER JOIN hashtags h ON t.id = h.id_tweet INNER JOIN user u ON t.id_user = u.id WHERE h.content = ? AND u.pseudo = ?
Thanks ;)
hashtagsgroup by content order by X desc limit 10 - Jeff Breadner