detectando cada día dado en la base de datos [cerrado]

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 a edate?

preguntado el 23 de abril de 13 a las 13:04

could you rephrase the question -

What do you mean by "detect?" -

if want to compare each office date with these days...not only for the sdate and edate that is respective 23/01/2010 and 27/01/2010.. -

1 Respuestas

As I don't have enough points to just comment I say "ALL IN!" and guess you mean you want to extract weekday information from the date field of the table, such as 'Sunday'(0), 'Monday'(1), Tuesday(2), etc.
If I'm right, the answer is this:
SELECT DAYOFWEEK(sdate) AS myDay FROM db_attendance

Or if you want to get the day as text instead of it's ID, you need to format it like this:
SELECT date_format(sdate, "%W") AS myDay2 FROM db_attendance

Respondido 23 Abr '13, 14:04

I'm upvoting you because you are making a guess and trying to help. My guess is that the OP wants to extract the number of days, showing the first record is 27-23= 4 days and the second is 29-23 = 6 days. My guess is the OP wants the mySQL DATESUB function. - MikeY

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.