我有如下原始SQL查询
select feed_items.feed_item_id, title
from feed_items
inner join tags
on feed_items.feed_item_id = tags.feed_item_id
where (select symbol from symbol_name_rules where name = 'apple')= any(tags)
order by pubdate desc limit 5;
效果很好,我正在尝试使用sequelize重写它,这一直给我一个错误
models.FeedItem.findAll({
attributes: [
'feedItemId',
'Tag.tags'
],
order: [['pubdate', 'DESC']],
include: [{ model: models.Tag, attributes: [] }],
limit: 50,
logging: console.log,
raw: true,
where: {
[models.Sequelize.Op.and]: [models.sequelize.literal('SELECT symbol FROM symbol_name_rules WHERE name="apple"=ANY(tags)')]
}
}).then(console.log)
它一直给我这个错误未处理的拒绝SequelizeDatabaseError:语法错误位于“ =”或附近
任何人都可以建议如何解决此问题