Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Miliceconds + Group By (Interval of 5 Seconds)

 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have one table which contains 2 columns.

ID int
ms long (which is milicecond)

i want a query which gives me the list of
count of records which are between 1 - 5 seconds,6 - 10 seconds, 11 - 15 seconds and so on.

i.e my query out put should look like

CountInterval
-------------------------
10 1 - 5
54 6 - 10
84 11 - 15
45 16 - 20
and so on....


How do get that done ???
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jigar,
I think the functions for this are database specific. Check (or post) your database for a cleaner way of doing this.

If you are using a bare bones database, you could group by int(colValue / 5 ). Again syntax may vary. The example is getting the integer value when diving by five.
 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ya i am using MySQL 5.0
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic