Here i tried solving it using MYSQL with recursive cte as ( select days,length(days) - length(replace(days,",","")) +1 as cnt from combination union select days,cnt-1 from cte where cnt >1), cte2 as ( select *, substring_index(substring_index(days,",",cnt),",",-1) as wrd from cte ) select days, max(if(wrd="F",'TRUE',null)) as friday, max(if(wrd="M",'TRUE',null)) as monday, max(if(wrd="R",'TRUE',null)) as thursday, max(if(wrd="S",'TRUE',null)) as saturday, max(if(wrd="T",'TRUE',null)) as tuesday, max(if(wrd="U",'TRUE',null)) as sunday, max(if(wrd="W",'TRUE',null)) as wednesday from cte2 as c1 join weeks as w on c1.wrd = w.letter group by days
Nice bro 😊 way u teaching do some video basic to advance sql sir
Superb explanation 👌 👏 👍
Thank you 🙂
What if there are duplicates? Can I just add a row_number as id and do the joins based that id. Does that solve the problem for duplicates?
How to add this combination table do we need to create sir
We need to create it. Script is there in the description
bro dax meeda videos start chey bro
No one is watching bro
Here i tried solving it using MYSQL
with recursive cte as (
select days,length(days) - length(replace(days,",","")) +1 as cnt
from combination
union
select days,cnt-1
from cte
where cnt >1),
cte2 as (
select *,
substring_index(substring_index(days,",",cnt),",",-1) as wrd
from cte
)
select days,
max(if(wrd="F",'TRUE',null)) as friday,
max(if(wrd="M",'TRUE',null)) as monday,
max(if(wrd="R",'TRUE',null)) as thursday,
max(if(wrd="S",'TRUE',null)) as saturday,
max(if(wrd="T",'TRUE',null)) as tuesday,
max(if(wrd="U",'TRUE',null)) as sunday,
max(if(wrd="W",'TRUE',null)) as wednesday
from cte2 as c1 join weeks as w
on c1.wrd = w.letter
group by days
Bro..
With out pivot..
Tell me
Transform rows into columns WITHOUT PIVOT operator in SQL
ua-cam.com/video/WfQGE7FQZGI/v-deo.html