Roundcube Community Forum

 

Time lapses query

Started by kinhteroi, April 07, 2009, 12:04:59 AM

Previous topic - Next topic

kinhteroi

Time lapses querytra
I need help with this, the query I designed is to know how many people comes at certain hours each day of the week.

But sadly I have to manually set the Hora (hour) to have correct time lapses, they should be one hour.

My question is... is there a way for a query to return me all the results in 1 hour lapses?. So it goes:

From 8 to 9 am then
from 9 to 10 am, etc.

My query is:

Code:

select Menu,Hora,COUNT(DISTINCT citas.idCita),
DATE_FORMAT(`Fecha`, '%W')
from medpro.citas
LEFT OUTER JOIN medpro.conceptos ON
medpro.citas.Conceptos=conceptos.idConcepto
WHERE fecha between '2008-11-01' and now()
AND Hora between '8:00:00'AND '9:00:00'  <== Problem
AND Horaentrada!='00:00:00'

GROUP BY Menu,DATE_FORMAT(`Fecha`, '%W')
ORDER BY Menu,DATE_FORMAT(`Fecha`, '%W')

rosali

Hmmm .... this is a RoundCube Webmail support forum.
Regards,
Rosali