Roundcube Community Forum

News and Announcements => General Discussion => Topic started by: kinhteroi on April 07, 2009, 12:04:59 AM

Title: Time lapses query
Post by: kinhteroi on April 07, 2009, 12:04:59 AM
Time lapses query (http://forums.devshed.com/mysql-help-4/time-lapses-query-question-602288.html)tra (http://www.tienphatjsc.vn)
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')
Title: Time lapses query
Post by: rosali on April 07, 2009, 04:34:05 AM
Hmmm .... this is a RoundCube Webmail support forum.