select d.* from yourtable a right join
( select * from (
(select id,day from yourtable group by id,day having count(*)<24) a
cross join
(select 1 union select 2 ...union select 24) b
) c
) d
on a.id=d.id and a.day=d.day
where a.id is null or a.day is null
( select * from (
(select id,day from yourtable group by id,day having count(*)<24) a
cross join
(select 1 union select 2 ...union select 24) b
) c
) d
on a.id=d.id and a.day=d.day
where a.id is null or a.day is null
select 1 as hour union select 2 as hour ...union select 24 as houron a.id=d.id and a.day=d.day and a.hour=d.hour
where a.id is null or a.day is null
(
select id,day,hour from
(select distinct id,day from tablename) as a cross join
(select 1 as hour union select 2 as hour ...union select 24 as hour
) as b
) as c left join tablename d
on c.id=d.id
and c.day=d.day
and c.hour=d.hour
where d.hour is null
谢谢coowoo(一日一日) 的参与