请帮助
如何实现请求“ SELECT EXISTS(SELECT FROM FROM Followers WHERE follower_id = 100);”通过Sequelize并将结果显示在单独的字段中?
类似的东西
await Followers.findAll({
where: { user_id: userId },
include: [
{
model: Followers,
as: 'isSubscribed',
...
},
},
]
答案 0 :(得分:0)
做类似
let followersCount = Followers.count({ where: {follower_id: 100} })
if(followersCount > 0){
//EXISTS, Do Something
}
else{
//Does not exist
}