- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
假设我有这个数据库标准对象-
let criteria = {
limit: limit,
offset: offset,
include: [
{
model: Comments,
include: [
{
model: User.scope('public')
},
{
model: Likes
}
]
},
{
model: User.scope('public')
},
{
model: AdOptions,
},
{
model: Images,
},
{
model: Questions,
},
{
model: Likes,
},
{
model: Videos
},
{
model: Tags
}
] ,
/*
* Get only those posts which are from user's friends, public, self created or ads
*/
where: {
[op.or]: [
{
UserId: friendIds
},
{
AdOptionId: { [op.ne]: null}
},
{
public: { [op.eq]: true},
'$Tags.id$': TagsIdsArray
}
]}
};
我这样使用它 -
Posts.findAll(criteria)
。.
我收到以下错误-
{"name":"SequelizeDatabaseError","parent":{"code":"ER_BAD_FIELD_ERROR","errno":1054,"sqlState":"42S22","sqlMessage":"Unknown column 'Tags.id' in 'where clause'","sql":"SELECT `Posts`.*, `Comments`.`id` AS `Comments.id`, `Comments`.`type` AS `Comments.type`, `Comments`.`comment` AS `Comments.comment`, `Comments`.`createdAt` AS `Comments.createdAt`, `Comments`.`updatedAt` AS `Comments.updatedAt`, `Comments`.`PostId` AS `Comments.PostId`, `Comments`.`UserId` AS `Comments.UserId`, `Comments->PostComments`.`createdAt` AS `Comments.PostComments.createdAt`, `Comments->PostComments`.`updatedAt` AS `Comments.PostComments.updatedAt`, `Comments->PostComments`.`PostId` AS `Comments.PostComments.PostId`, `Comments->PostComments`.`CommentId` AS `Comments.PostComments.CommentId`, `Comments->User`.`id` AS `Comments.User.id`, `Comments->User`.`first` AS `Comments.User.first`, `Comments->User`.`last` AS `Comments.User.last`, `Comments->User`.`phone` AS `Comments.User.phone`, `Comments->User`.`pic` AS `Comments.User.pic`, `Comments->Likes`.`id` AS `Comments.Likes.id`, `Comments->Likes`.`createdAt` AS `Comments.Likes.createdAt`, `Comments->Likes`.`updatedAt` AS `Comments.Likes.updatedAt`, `Comments->Likes`.`UserId` AS `Comments.Likes.UserId`, `Comments->Likes`.`PostId` AS `Comments.Likes.PostId`, `Comments->Likes`.`CommentId` AS `Comments.Likes.CommentId`, `Comments->Likes->CommentLikes`.`createdAt` AS `Comments.Likes.CommentLikes.createdAt`, `Comments->Likes->CommentLikes`.`updatedAt` AS `Comments.Likes.CommentLikes.updatedAt`, `Comments->Likes->CommentLikes`.`CommentId` AS `Comments.Likes.CommentLikes.CommentId`, `Comments->Likes->CommentLikes`.`LikeId` AS `Comments.Likes.CommentLikes.LikeId`, `User`.`id` AS `User.id`, `User`.`first` AS `User.first`, `User`.`last` AS `User.last`, `User`.`phone` AS `User.phone`, `User`.`pic` AS `User.pic`, `AdOption`.`id` AS `AdOption.id`, `AdOption`.`postIsAd` AS `AdOption.postIsAd`, `AdOption`.`cpc` AS `AdOption.cpc`, `AdOption`.`cpv` AS `AdOption.cpv`, `AdOption`.`clickURL` AS `AdOption.clickURL`, `AdOption`.`createdAt` AS `AdOption.createdAt`, `AdOption`.`updatedAt` AS `AdOption.updatedAt`, `AdOption`.`UserId` AS `AdOption.UserId`, `Images`.`id` AS `Images.id`, `Images`.`path` AS `Images.path`, `Images`.`createdAt` AS `Images.createdAt`, `Images`.`updatedAt` AS `Images.updatedAt`, `Images`.`UserId` AS `Images.UserId`, `Images`.`PostId` AS `Images.PostId`, `Images->PostImages`.`createdAt` AS `Images.PostImages.createdAt`, `Images->PostImages`.`updatedAt` AS `Images.PostImages.updatedAt`, `Images->PostImages`.`PostId` AS `Images.PostImages.PostId`, `Images->PostImages`.`ImageId` AS `Images.PostImages.ImageId`, `Question`.`id` AS `Question.id`, `Question`.`question` AS `Question.question`, `Question`.`description` AS `Question.description`, `Question`.`createdAt` AS `Question.createdAt`, `Question`.`updatedAt` AS `Question.updatedAt`, `Question`.`UserId` AS `Question.UserId`, `Likes`.`id` AS `Likes.id`, `Likes`.`createdAt` AS `Likes.createdAt`, `Likes`.`updatedAt` AS `Likes.updatedAt`, `Likes`.`UserId` AS `Likes.UserId`, `Likes`.`PostId` AS `Likes.PostId`, `Likes`.`CommentId` AS `Likes.CommentId`, `Likes->PostLikes`.`createdAt` AS `Likes.PostLikes.createdAt`, `Likes->PostLikes`.`updatedAt` AS `Likes.PostLikes.updatedAt`, `Likes->PostLikes`.`PostId` AS `Likes.PostLikes.PostId`, `Likes->PostLikes`.`LikeId` AS `Likes.PostLikes.LikeId`, `Video`.`id` AS `Video.id`, `Video`.`title` AS `Video.title`, `Video`.`description` AS `Video.description`, `Video`.`path` AS `Video.path`, `Video`.`createdAt` AS `Video.createdAt`, `Video`.`updatedAt` AS `Video.updatedAt`, `Video`.`UserId` AS `Video.UserId`, `Tags`.`id` AS `Tags.id`, `Tags`.`name` AS `Tags.name`, `Tags`.`icon` AS `Tags.icon`, `Tags`.`UserId` AS `Tags.UserId`, `Tags`.`createdAt` AS `Tags.createdAt`, `Tags`.`updatedAt` AS `Tags.updatedAt`, `Tags->PostsTags`.`createdAt` AS `Tags.PostsTags.createdAt`, `Tags->PostsTags`.`updatedAt` AS `Tags.PostsTags.updatedAt`, `Tags->PostsTags`.`PostId` AS `Tags.PostsTags.PostId`, `Tags->PostsTags`.`TagId` AS `Tags.PostsTags.TagId` FROM (SELECT `Posts`.`id`, `Posts`.`type`, `Posts`.`content`, `Posts`.`public`, `Posts`.`createdAt`, `Posts`.`updatedAt`, `Posts`.`UserId`, `Posts`.`QuestionId`, `Posts`.`AdOptionId`, `Posts`.`VideoId` FROM `Posts` AS `Posts` WHERE (`Posts`.`UserId` IN (1) OR `Posts`.`AdOptionId` IS NOT NULL OR (`Posts`.`public` = true AND `Tags`.`id` IN (1))) ORDER BY `Posts`.`updatedAt` DESC LIMIT 0, 10) AS `Posts` LEFT OUTER JOIN ( `PostComments` AS `Comments->PostComments` INNER JOIN `Comments` AS `Comments` ON `Comments`.`id` = `Comments->PostComments`.`CommentId`) ON `Posts`.`id` = `Comments->PostComments`.`PostId` LEFT OUTER JOIN `Users` AS `Comments->User` ON `Comments`.`UserId` = `Comments->User`.`id` LEFT OUTER JOIN ( `CommentLikes` AS `Comments->Likes->CommentLikes` INNER JOIN `Likes` AS `Comments->Likes` ON `Comments->Likes`.`id` = `Comments->Likes->CommentLikes`.`LikeId`) ON `Comments`.`id` = `Comments->Likes->CommentLikes`.`CommentId` LEFT OUTER JOIN `Users` AS `User` ON `Posts`.`UserId` = `User`.`id` LEFT OUTER JOIN `AdOptions` AS `AdOption` ON `Posts`.`AdOptionId` = `AdOption`.`id` LEFT OUTER JOIN ( `PostImages` AS `Images->PostImages` INNER JOIN `Images` AS `Images` ON `Images`.`id` = `Images->PostImages`.`ImageId`) ON `Posts`.`id` = `Images->PostImages`.`PostId` LEFT OUTER JOIN `Questions` AS `Question` ON `Posts`.`QuestionId` = `Question`.`id` LEFT OUTER JOIN ( `PostLikes` AS `Likes->PostLikes` INNER JOIN `Likes` AS `Likes` ON `Likes`.`id` = `Likes->PostLikes`.`LikeId`) ON `Posts`.`id` = `Likes->PostLikes`.`PostId` LEFT OUTER JOIN `Videos` AS `Video` ON `Posts`.`VideoId` = `Video`.`id` LEFT OUTER JOIN ( `PostsTags` AS `Tags->PostsTags` INNER JOIN `Tags` AS `Tags` ON `Tags`.`id` = `Tags->PostsTags`.`TagId`) ON `Posts`.`id` = `Tags->PostsTags`.`PostId` ORDER BY `Posts`.`updatedAt` DESC;"},"original":{"code":"ER_BAD_FIELD_ERROR","errno":1054,"sqlState":"42S22","sqlMessage":"Unknown column 'Tags.id' in 'where clause'","sql":"SELECT `Posts`.*, `Comments`.`id` AS `Comments.id`, `Comments`.`type` AS `Comments.type`, `Comments`.`comment` AS `Comments.comment`, `Comments`.`createdAt` AS `Comments.createdAt`, `Comments`.`updatedAt` AS `Comments.updatedAt`, `Comments`.`PostId` AS `Comments.PostId`, `Comments`.`UserId` AS `Comments.UserId`, `Comments->PostComments`.`createdAt` AS `Comments.PostComments.createdAt`, `Comments->PostComments`.`updatedAt` AS `Comments.PostComments.updatedAt`, `Comments->PostComments`.`PostId` AS `Comments.PostComments.PostId`, `Comments->PostComments`.`CommentId` AS `Comments.PostComments.CommentId`, `Comments->User`.`id` AS `Comments.User.id`, `Comments->User`.`first` AS `Comments.User.first`, `Comments->User`.`last` AS `Comments.User.last`, `Comments->User`.`phone` AS `Comments.User.phone`, `Comments->User`.`pic` AS `Comments.User.pic`, `Comments->Likes`.`id` AS `Comments.Likes.id`, `Comments->Likes`.`createdAt` AS `Comments.Likes.createdAt`, `Comments->Likes`.`updatedAt` AS `Comments.Likes.updatedAt`, `Comments->Likes`.`UserId` AS `Comments.Likes.UserId`, `Comments->Likes`.`PostId` AS `Comments.Likes.PostId`, `Comments->Likes`.`CommentId` AS `Comments.Likes.CommentId`, `Comments->Likes->CommentLikes`.`createdAt` AS `Comments.Likes.CommentLikes.createdAt`, `Comments->Likes->CommentLikes`.`updatedAt` AS `Comments.Likes.CommentLikes.updatedAt`, `Comments->Likes->CommentLikes`.`CommentId` AS `Comments.Likes.CommentLikes.CommentId`, `Comments->Likes->CommentLikes`.`LikeId` AS `Comments.Likes.CommentLikes.LikeId`, `User`.`id` AS `User.id`, `User`.`first` AS `User.first`, `User`.`last` AS `User.last`, `User`.`phone` AS `User.phone`, `User`.`pic` AS `User.pic`, `AdOption`.`id` AS `AdOption.id`, `AdOption`.`postIsAd` AS `AdOption.postIsAd`, `AdOption`.`cpc` AS `AdOption.cpc`, `AdOption`.`cpv` AS `AdOption.cpv`, `AdOption`.`clickURL` AS `AdOption.clickURL`, `AdOption`.`createdAt` AS `AdOption.createdAt`, `AdOption`.`updatedAt` AS `AdOption.updatedAt`, `AdOption`.`UserId` AS `AdOption.UserId`, `Images`.`id` AS `Images.id`, `Images`.`path` AS `Images.path`, `Images`.`createdAt` AS `Images.createdAt`, `Images`.`updatedAt` AS `Images.updatedAt`, `Images`.`UserId` AS `Images.UserId`, `Images`.`PostId` AS `Images.PostId`, `Images->PostImages`.`createdAt` AS `Images.PostImages.createdAt`, `Images->PostImages`.`updatedAt` AS `Images.PostImages.updatedAt`, `Images->PostImages`.`PostId` AS `Images.PostImages.PostId`, `Images->PostImages`.`ImageId` AS `Images.PostImages.ImageId`, `Question`.`id` AS `Question.id`, `Question`.`question` AS `Question.question`, `Question`.`description` AS `Question.description`, `Question`.`createdAt` AS `Question.createdAt`, `Question`.`updatedAt` AS `Question.updatedAt`, `Question`.`UserId` AS `Question.UserId`, `Likes`.`id` AS `Likes.id`, `Likes`.`createdAt` AS `Likes.createdAt`, `Likes`.`updatedAt` AS `Likes.updatedAt`, `Likes`.`UserId` AS `Likes.UserId`, `Likes`.`PostId` AS `Likes.PostId`, `Likes`.`CommentId` AS `Likes.CommentId`, `Likes->PostLikes`.`createdAt` AS `Likes.PostLikes.createdAt`, `Likes->PostLikes`.`updatedAt` AS `Likes.PostLikes.updatedAt`, `Likes->PostLikes`.`PostId` AS `Likes.PostLikes.PostId`, `Likes->PostLikes`.`LikeId` AS `Likes.PostLikes.LikeId`, `Video`.`id` AS `Video.id`, `Video`.`title` AS `Video.title`, `Video`.`description` AS `Video.description`, `Video`.`path` AS `Video.path`, `Video`.`createdAt` AS `Video.createdAt`, `Video`.`updatedAt` AS `Video.updatedAt`, `Video`.`UserId` AS `Video.UserId`, `Tags`.`id` AS `Tags.id`, `Tags`.`name` AS `Tags.name`, `Tags`.`icon` AS `Tags.icon`, `Tags`.`UserId` AS `Tags.UserId`, `Tags`.`createdAt` AS `Tags.createdAt`, `Tags`.`updatedAt` AS `Tags.updatedAt`, `Tags->PostsTags`.`createdAt` AS `Tags.PostsTags.createdAt`, `Tags->PostsTags`.`updatedAt` AS `Tags.PostsTags.updatedAt`, `Tags->PostsTags`.`PostId` AS `Tags.PostsTags.PostId`, `Tags->PostsTags`.`TagId` AS `Tags.PostsTags.TagId` FROM (SELECT `Posts`.`id`, `Posts`.`type`, `Posts`.`content`, `Posts`.`public`, `Posts`.`createdAt`, `Posts`.`updatedAt`, `Posts`.`UserId`, `Posts`.`QuestionId`, `Posts`.`AdOptionId`, `Posts`.`VideoId` FROM `Posts` AS `Posts` WHERE (`Posts`.`UserId` IN (1) OR `Posts`.`AdOptionId` IS NOT NULL OR (`Posts`.`public` = true AND `Tags`.`id` IN (1))) ORDER BY `Posts`.`updatedAt` DESC LIMIT 0, 10) AS `Posts` LEFT OUTER JOIN ( `PostComments` AS `Comments->PostComments` INNER JOIN `Comments` AS `Comments` ON `Comments`.`id` = `Comments->PostComments`.`CommentId`) ON `Posts`.`id` = `Comments->PostComments`.`PostId` LEFT OUTER JOIN `Users` AS `Comments->User` ON `Comments`.`UserId` = `Comments->User`.`id` LEFT OUTER JOIN ( `CommentLikes` AS `Comments->Likes->CommentLikes` INNER JOIN `Likes` AS `Comments->Likes` ON `Comments->Likes`.`id` = `Comments->Likes->CommentLikes`.`LikeId`) ON `Comments`.`id` = `Comments->Likes->CommentLikes`.`CommentId` LEFT OUTER JOIN `Users` AS `User` ON `Posts`.`UserId` = `User`.`id` LEFT OUTER JOIN `AdOptions` AS `AdOption` ON `Posts`.`AdOptionId` = `AdOption`.`id` LEFT OUTER JOIN ( `PostImages` AS `Images->PostImages` INNER JOIN `Images` AS `Images` ON `Images`.`id` = `Images->PostImages`.`ImageId`) ON `Posts`.`id` = `Images->PostImages`.`PostId` LEFT OUTER JOIN `Questions` AS `Question` ON `Posts`.`QuestionId` = `Question`.`id` LEFT OUTER JOIN ( `PostLikes` AS `Likes->PostLikes` INNER JOIN `Likes` AS `Likes` ON `Likes`.`id` = `Likes->PostLikes`.`LikeId`) ON `Posts`.`id` = `Likes->PostLikes`.`PostId` LEFT OUTER JOIN `Videos` AS `Video` ON `Posts`.`VideoId` = `Video`.`id` LEFT OUTER JOIN ( `PostsTags` AS `Tags->PostsTags` INNER JOIN `Tags` AS `Tags` ON `Tags`.`id` = `Tags->PostsTags`.`TagId`) ON `Posts`.`id` = `Tags->PostsTags`.`PostId` ORDER BY `Posts`.`updatedAt` DESC;"},"sql":"SELECT `Posts`.*, `Comments`.`id` AS `Comments.id`, `Comments`.`type` AS `Comments.type`, `Comments`.`comment` AS `Comments.comment`, `Comments`.`createdAt` AS `Comments.createdAt`, `Comments`.`updatedAt` AS `Comments.updatedAt`, `Comments`.`PostId` AS `Comments.PostId`, `Comments`.`UserId` AS `Comments.UserId`, `Comments->PostComments`.`createdAt` AS `Comments.PostComments.createdAt`, `Comments->PostComments`.`updatedAt` AS `Comments.PostComments.updatedAt`, `Comments->PostComments`.`PostId` AS `Comments.PostComments.PostId`, `Comments->PostComments`.`CommentId` AS `Comments.PostComments.CommentId`, `Comments->User`.`id` AS `Comments.User.id`, `Comments->User`.`first` AS `Comments.User.first`, `Comments->User`.`last` AS `Comments.User.last`, `Comments->User`.`phone` AS `Comments.User.phone`, `Comments->User`.`pic` AS `Comments.User.pic`, `Comments->Likes`.`id` AS `Comments.Likes.id`, `Comments->Likes`.`createdAt` AS `Comments.Likes.createdAt`, `Comments->Likes`.`updatedAt` AS `Comments.Likes.updatedAt`, `Comments->Likes`.`UserId` AS `Comments.Likes.UserId`, `Comments->Likes`.`PostId` AS `Comments.Likes.PostId`, `Comments->Likes`.`CommentId` AS `Comments.Likes.CommentId`, `Comments->Likes->CommentLikes`.`createdAt` AS `Comments.Likes.CommentLikes.createdAt`, `Comments->Likes->CommentLikes`.`updatedAt` AS `Comments.Likes.CommentLikes.updatedAt`, `Comments->Likes->CommentLikes`.`CommentId` AS `Comments.Likes.CommentLikes.CommentId`, `Comments->Likes->CommentLikes`.`LikeId` AS `Comments.Likes.CommentLikes.LikeId`, `User`.`id` AS `User.id`, `User`.`first` AS `User.first`, `User`.`last` AS `User.last`, `User`.`phone` AS `User.phone`, `User`.`pic` AS `User.pic`, `AdOption`.`id` AS `AdOption.id`, `AdOption`.`postIsAd` AS `AdOption.postIsAd`, `AdOption`.`cpc` AS `AdOption.cpc`, `AdOption`.`cpv` AS `AdOption.cpv`, `AdOption`.`clickURL` AS `AdOption.clickURL`, `AdOption`.`createdAt` AS `AdOption.createdAt`, `AdOption`.`updatedAt` AS `AdOption.updatedAt`, `AdOption`.`UserId` AS `AdOption.UserId`, `Images`.`id` AS `Images.id`, `Images`.`path` AS `Images.path`, `Images`.`createdAt` AS `Images.createdAt`, `Images`.`updatedAt` AS `Images.updatedAt`, `Images`.`UserId` AS `Images.UserId`, `Images`.`PostId` AS `Images.PostId`, `Images->PostImages`.`createdAt` AS `Images.PostImages.createdAt`, `Images->PostImages`.`updatedAt` AS `Images.PostImages.updatedAt`, `Images->PostImages`.`PostId` AS `Images.PostImages.PostId`, `Images->PostImages`.`ImageId` AS `Images.PostImages.ImageId`, `Question`.`id` AS `Question.id`, `Question`.`question` AS `Question.question`, `Question`.`description` AS `Question.description`, `Question`.`createdAt` AS `Question.createdAt`, `Question`.`updatedAt` AS `Question.updatedAt`, `Question`.`UserId` AS `Question.UserId`, `Likes`.`id` AS `Likes.id`, `Likes`.`createdAt` AS `Likes.createdAt`, `Likes`.`updatedAt` AS `Likes.updatedAt`, `Likes`.`UserId` AS `Likes.UserId`, `Likes`.`PostId` AS `Likes.PostId`, `Likes`.`CommentId` AS `Likes.CommentId`, `Likes->PostLikes`.`createdAt` AS `Likes.PostLikes.createdAt`, `Likes->PostLikes`.`updatedAt` AS `Likes.PostLikes.updatedAt`, `Likes->PostLikes`.`PostId` AS `Likes.PostLikes.PostId`, `Likes->PostLikes`.`LikeId` AS `Likes.PostLikes.LikeId`, `Video`.`id` AS `Video.id`, `Video`.`title` AS `Video.title`, `Video`.`description` AS `Video.description`, `Video`.`path` AS `Video.path`, `Video`.`createdAt` AS `Video.createdAt`, `Video`.`updatedAt` AS `Video.updatedAt`, `Video`.`UserId` AS `Video.UserId`, `Tags`.`id` AS `Tags.id`, `Tags`.`name` AS `Tags.name`, `Tags`.`icon` AS `Tags.icon`, `Tags`.`UserId` AS `Tags.UserId`, `Tags`.`createdAt` AS `Tags.createdAt`, `Tags`.`updatedAt` AS `Tags.updatedAt`, `Tags->PostsTags`.`createdAt` AS `Tags.PostsTags.createdAt`, `Tags->PostsTags`.`updatedAt` AS `Tags.PostsTags.updatedAt`, `Tags->PostsTags`.`PostId` AS `Tags.PostsTags.PostId`, `Tags->PostsTags`.`TagId` AS `Tags.PostsTags.TagId` FROM (SELECT `Posts`.`id`, `Posts`.`type`, `Posts`.`content`, `Posts`.`public`, `Posts`.`createdAt`, `Posts`.`updatedAt`, `Posts`.`UserId`, `Posts`.`QuestionId`, `Posts`.`AdOptionId`, `Posts`.`VideoId` FROM `Posts` AS `Posts` WHERE (`Posts`.`UserId` IN (1) OR `Posts`.`AdOptionId` IS NOT NULL OR (`Posts`.`public` = true AND `Tags`.`id` IN (1))) ORDER BY `Posts`.`updatedAt` DESC LIMIT 0, 10) AS `Posts` LEFT OUTER JOIN ( `PostComments` AS `Comments->PostComments` INNER JOIN `Comments` AS `Comments` ON `Comments`.`id` = `Comments->PostComments`.`CommentId`) ON `Posts`.`id` = `Comments->PostComments`.`PostId` LEFT OUTER JOIN `Users` AS `Comments->User` ON `Comments`.`UserId` = `Comments->User`.`id` LEFT OUTER JOIN ( `CommentLikes` AS `Comments->Likes->CommentLikes` INNER JOIN `Likes` AS `Comments->Likes` ON `Comments->Likes`.`id` = `Comments->Likes->CommentLikes`.`LikeId`) ON `Comments`.`id` = `Comments->Likes->CommentLikes`.`CommentId` LEFT OUTER JOIN `Users` AS `User` ON `Posts`.`UserId` = `User`.`id` LEFT OUTER JOIN `AdOptions` AS `AdOption` ON `Posts`.`AdOptionId` = `AdOption`.`id` LEFT OUTER JOIN ( `PostImages` AS `Images->PostImages` INNER JOIN `Images` AS `Images` ON `Images`.`id` = `Images->PostImages`.`ImageId`) ON `Posts`.`id` = `Images->PostImages`.`PostId` LEFT OUTER JOIN `Questions` AS `Question` ON `Posts`.`QuestionId` = `Question`.`id` LEFT OUTER JOIN ( `PostLikes` AS `Likes->PostLikes` INNER JOIN `Likes` AS `Likes` ON `Likes`.`id` = `Likes->PostLikes`.`LikeId`) ON `Posts`.`id` = `Likes->PostLikes`.`PostId` LEFT OUTER JOIN `Videos` AS `Video` ON `Posts`.`VideoId` = `Video`.`id` LEFT OUTER JOIN ( `PostsTags` AS `Tags->PostsTags` INNER JOIN `Tags` AS `Tags` ON `Tags`.`id` = `Tags->PostsTags`.`TagId`) ON `Posts`.`id` = `Tags->PostsTags`.`PostId` ORDER BY `Posts`.`updatedAt` DESC;","success":true}
为什么我收到错误“where 子句”中的未知列“Tags.id”?
请帮忙。我希望我已经提供了足够的信息,如果没有,请告诉我您是否还想了解其他信息?谢谢!
最佳答案
我解决了这个问题。我发现在父级的 where 子句中引用子模型/表的列会破坏查询,因为父模型中使用了限制和偏移参数(很抱歉没有在原始问题中发布限制和偏移代码片段,我编辑了问题并添加了现在)。
所以我发现了一种巧妙的方法,通过调整 ORDER 参数并在其中包含限制和偏移量。
因此,从父级中删除 Limit 和 Offset 参数并将 ORDER 参数更改为此解决了我的问题-
order: Sequelize.literal('updatedAt DESC LIMIT '+ offset + ',' + limit),
关于mysql - 为什么在 where 查询中引用其他表的列不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54034619/
今天有小伙伴给我留言问到,try{...}catch(){...}是什么意思?它用来干什么? 简单的说 他们是用来捕获异常的 下面我们通过一个例子来详细讲解下
我正在努力提高网站的可访问性,但我不知道如何在页脚中标记社交媒体链接列表。这些链接指向我在 facecook、twitter 等上的帐户。我不想用 role="navigation" 标记这些链接,因
说现在是 6 点,我有一个 Timer 并在 10 点安排了一个 TimerTask。之后,System DateTime 被其他服务(例如 ntp)调整为 9 点钟。我仍然希望我的 TimerTas
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我就废话不多说了,大家还是直接看代码吧~ ? 1
Maven系列1 1.什么是Maven? Maven是一个项目管理工具,它包含了一个对象模型。一组标准集合,一个依赖管理系统。和用来运行定义在生命周期阶段中插件目标和逻辑。 核心功能 Mav
我是一名优秀的程序员,十分优秀!