I'm trying for 2 hours to resolve a little problem which is not one. I'm on an generated yeoman Angular-fullstack App.
I want to write this code with sequelize:
SELECT *
FROM demand
WHERE city_id NOT IN (
SELECT city_id
FROM demand
WHERE user_id=req.params.user_id)
I have yet the following code but that doesn't work. I get only []
export function getCity(req, res) {
return Demand.findAll({
where: {
city_id:{ $notIn: Demand.findAll({
attributes: ['city_id'],
where: {
user_id: req.params.user_id,
}
})}
}
})
.then(handleEntityNotFound(res))
.then(respondWithResult(res))
.catch(handleError(res));
}
Have you a clue? Thank you.