我试图显示最近两天最流行的项目,但这个视图是让两天前发生的项目进入。
它是用来查找最近两天最受欢迎的(可能是 20-30 个项目)并用随机项目填充剩余的项目(需要始终在视图中显示 1000 个项目)
我怎样才能解决这个问题?
谢谢
CREATE
ALGORITHM = UNDEFINED
DEFINER = `XX`@`XX`
SQL SECURITY DEFINER
VIEW `trending` AS
select
`question`.`name` AS `name`,
`question`.`questionUrl` AS `questionUrl`,
`question`.`miRating` AS `miRating`,
`question`.`imageUrl` AS `imageUrl`,
`question`.`miThumbnail` AS `miThumbnail`,
`question`.`foundOn` AS `foundOn`,
`question`.`myId` AS `myId`
from
(`question`
join `feed` ON ((`question`.`myId` = `feed`.`question_id`)))
group by `question`.`name`
order by (`feed`.`timeStamp` >= (now() - interval 1 day)) desc ,
(`feed`.`question_id` is not null) desc ,
(((`question`.`likesCount` * 0.8) + (`question`.`commentsCount` * 0.6)) + ((`question`.`sharesCount` * 1) / 2.4)) desc
limit 0 , 1000