-3

For one of my php projects I have a database db_attendance where I have a table like this:

lid empname  username nod  sdate        edate     reason   action   empID
==  =======  ======== === ==========  ========== ======== ======== =======            
01  will     william   1  23/01/2010  27/01/2010 for exam accepted   4
01  will     james     1  23/01/2010  29/01/2010 for exam accepted   2

is there any way to detect each day of sdate to edate?

4

1 回答 1

1

因为我没有足够的分数来评论,所以我说“ALL IN!” 猜你的意思是要从表格的日期字段中提取工作日信息,例如'Sunday'(0)、'Monday'(1)、Tuesday(2) 等。
如果我是对的,答案是这个:
SELECT DAYOFWEEK(sdate) AS myDay FROM db_attendance

或者如果你想将日期作为文本而不是它的 ID,你需要像这样格式化它:
SELECT date_format(sdate, "%W") AS myDay2 FROM db_attendance

于 2013-04-23T13:17:54.263 回答