按日期而不是工作周显示 MYSQL C#
Display by date not by workweek MYSQL C#
谁能帮我按日期而不是年周显示我的代码
我的数据是每天安排的,我想按周汇总,如 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
由于没有至少 50 声望,我无法发表评论;所以我不能问清楚问题。
使用 STR_TO_DATE 可以解决您的问题吗?
SELECT STR_TO_DATE(CONCAT(YEARWEEK("2021-03-10"), ' Wednesday'), '%X%V %W');
>> 2021-03-10
注意:您需要提供星期几作为 STR_TO_DATE 的第二个参数。
您可以通过连接空 space 和 DAYNAME(date).
来形成第二个参数
Here 是 fiddle 证明这一点。
SELECT STR_TO_DATE(CONCAT(YEARWEEK((ScheduleFrom)),' Monday'), '%X%V %W') as ScheduleFrom from tblschedule
感谢帮助
谁能帮我按日期而不是年周显示我的代码 我的数据是每天安排的,我想按周汇总,如 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 |
由于没有至少 50 声望,我无法发表评论;所以我不能问清楚问题。
使用 STR_TO_DATE 可以解决您的问题吗?
SELECT STR_TO_DATE(CONCAT(YEARWEEK("2021-03-10"), ' Wednesday'), '%X%V %W');
>> 2021-03-10
注意:您需要提供星期几作为 STR_TO_DATE 的第二个参数。 您可以通过连接空 space 和 DAYNAME(date).
来形成第二个参数Here 是 fiddle 证明这一点。
SELECT STR_TO_DATE(CONCAT(YEARWEEK((ScheduleFrom)),' Monday'), '%X%V %W') as ScheduleFrom from tblschedule
感谢帮助