Author Topic: Time lapses query  (Read 2886 times)

Offline kinhteroi

  • Newbie
  • *
  • Posts: 2
Time lapses query
« on: April 07, 2009, 12:04:59 AM »
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')

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
Time lapses query
« Reply #1 on: April 07, 2009, 04:34:05 AM »
Hmmm .... this is a RoundCube Webmail support forum.
Regards,
Rosali
__________________
MyRoundcube Project (commercial)