Hello @everyone,
EmpID Week Day Class
80010 1 First Week 1 Sunday KG1
80016 1 First Week 1 Sunday KG1 B PLANNER
80016 1 First Week 1 Sunday KG1 A Planners
80016 1 First Week 2 Monday KG1 B COPYBOOKS
80016 1 First Week 2 Monday KG1 A copy books
80016 1 First Week 3 Tuesday KG2 C COPY BOOKS
80016 1 First Week 3 Tuesday KG2 C PLANNERS
80016 1 First Week 4 Wednesday KG2 B PLANNER
80016 1 First Week 4 Wednesday KG2 A planners
I have a table as above I want to group repeated class data with a ',' as below
EmpID Week Day Class
80010 1 First Week 1 Sunday KG1, A PLANNER, B PLANNER
First Week 2 Monday KG1, A copy books, B COPYBOOKS
First Week 3 Tuesday KG2 C COPY BOOKS, B COPYBOOKS
Kinldy help me how to achieve the above. Below is my Sql Query
Select distinct
lt.UserID as emp_id,
wm.week_num as WeekId,
wm.week as WeekName,
wd.week_day_num as DayId,
wd.Week_day as Name,
dr.duty_class as ClassName
from duty_roster_tbl dr, login_tbl lt, week_master_tbl wm, week_day_tbl wd
where dr.emp_id = lt.UserID and dr.week_num = wm.week_num and dr.week_day_num = wd.week_day_num
group by lt.UserID, wm.week_num, wm.week, wd.week_day_num, wd.Week_day, dr.duty_class
order by lt.UserID, wm.week_num, wd.week_day_num