56,677
社区成员
发帖
与我相关
我的任务
分享
CREATE TABLE `A` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`sid` int(11) DEFAULT NULL,
`score` float DEFAULT NULL,
`date` date DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
select *
from A t
where `date`>curdate()-interval 5 day
and not exists (select 1 from A where `date`>curdate()-interval 5 day and sid=t.sid and score>t.score)