获取从表中的一条记录,其中记录是所有日期
答
麻烦参阅表结构试试:(UPDATE)
select name, t.date_cnt
from yourtable
join (select count(distinct `date`) as date_cnt from yourtable) t
group by name
having count(distinct `date`) = date_cnt
对于过去6天数:
select name, t.date_cnt
from yourtable
join (
select count(distinct `date`) as date_cnt
from yourtable
where str_to_date(`date`, '%d-%m-%y') >= date_add(now(), interval -6 day)
) t
where str_to_date(`date`, '%d-%m-%y') >= date_add(now(), interval -6 day)
group by name
having count(distinct `date`) = date_cnt
请显示所需的结果。 –
请详细解释。 **存在于同一个表**的所有日期中?你的投入是什么? – 1000111
只需要不同的名称字段。 –