I would lIke to have Mysql group by days interval for example group by every 20 days from current day, like 1 - 20, 21 - 40, 41 - 60 and son on up to lets 120 days. The user can choose the days interval and up to how many days

  • 4
    And your question is? What do you have already? Commented Feb 27, 2013 at 16:29

1 Answer 1

select floor(days / 20) as daygroup, count(*)
from mytable
group by daygroup

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.