Shahid Ahmed Shahid Ahmed - 4 months ago 8
MySQL Question

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

Table columns and rows

Need records which are exists in all the dates of same table.
Here it should be record of x, y and z.
kindly refer table structure in above link image

JPG JPG
Answer

Try this: ( 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

Demo Here

For last 6 days:

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