Can anyone help me display my code by date like that not by yearweek My data is schedule per day and i want to summarize it by week like in table
"SELECT EmployeeName,AssignedArea,SectionName,TimeSchedule,YEARWEEK(ScheduleFrom) as ScheduleFrom from tblschedule WHERE ScheduleFrom BETWEEN '" + clsSQLcon.DateFrom1+"' AND '"+clsSQLcon.DateTo1+"'
[1]: Here is the sample of my output but i want it by date
Employeenames | 2021-03-01 | 2021-03-08 | 2021-03-15 | 2021-03-22 |
---|---|---|---|---|
Candare | time& section for the week | time& section for the week | time& section for the week | time& section for the week |
Mendoza | time& section for the week | time& section for the week | time& section for the week | time& section for the week |
Jocson | time& section for the week | time& section for the week | time& section for the week | time& section for the week |
Answer
I can’t comment due to not having at least 50 reputation; so I’m not able to ask clarifying questions.
Would using STR_TO_DATE solve your problem?
SELECT STR_TO_DATE(CONCAT(YEARWEEK("2021-03-10"), ' Wednesday'), '%X%V %W'); >> 2021-03-10
Note: You need to supply the day of the week as the 2nd parameter of STR_TO_DATE. You can form this second parameter by concatenating an empty space and DAYNAME(date).
Here is a fiddle demonstrating this.