SELECT COUNT(campo) FROM tabella WHERE (time<x) OR (time>x AND time<y) OR (time>y)

una cosa del genere...? non garatisco che funzioni però...