node.js - How i can merge two query in one findAndCount in sequelize? -


need make 1 findandcount() 2 partially different query

userid comes param, , return result depending on whether param buyerid in order or contained sellerid in good

models.order.findandcountall({     distinct: true,     limit,     offset,     where: {       archived: 1,       buyerid: userid,     },     include: [{       model: models.good,       where: { type: 'lineup' },       as: 'good',       include: userinclude     }]   }); 

and

models.order.findandcountall({     distinct: true,     limit,     offset,     where: {       archived: 1,     },     include: [{       model: models.good,       where: { type: 'lineup', sellerid: userid },       as: 'good',       include: userinclude     }]   }); 


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

Qt QGraphicsScene is not accessable from QGraphicsView (on Qt 5.6.1) -

What is happening when Matlab is starting a "parallel pool"? -