从 table 中获取记录在所有日期中的单个记录

Get a single record from a table where the record is in all the dates

Table columns and rows

需要在同一 table 的所有日期中都存在的记录。 这里应该是x,y,z的记录。 请参考上面link图像

中的table结构

试试这个:(更新)

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

Demo Here

过去 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

Last 6 days demo