MySQL Query 10 Tables (Sequelize or Raw Query) MySQL Query 10 Tables (Sequelize or Raw Query) sql sql

MySQL Query 10 Tables (Sequelize or Raw Query)


Since you seem to need a single resultset that is composed from two different joins, you should probably do something like

SELECT * from(SELECT 1 UNION ALL SELECT 2 ) aORDER by ...

Both your select statements should also include the logic name as distinct columns (like 'firstselect') - this way you will know which select your row comes from.


If you wanted to try to do a subquery with sequelize, you could use a literal in part of your query:

User.findAll({  attributes: [    [sequelize.literal('SELECT ...'), 'subq'],  ]}).then(function(users) {});