SQL - Group by minutes

Results 1 to 2 of 2

Thread: SQL - Group by minutes

  1. #1
    Join Date
    Dec 1969

    Default SQL - Group by minutes

    I&#039;m trying to group every 10 minutes together.<BR><BR>Ideas on how to get tis done?<BR><BR>jc

  2. #2
    Join Date
    Dec 1969

    Default Should be easy enough...

    SELECT ...<BR>FROM ...<BR>GROUP BY INT( DATEDIFF(&#039;N&#039;, #1/1/1970#, SomeDateAndTimeField ) / 10<BR>...<BR><BR>That&#039;s for Access; it would need minor tweaking for SQL Server or MySQL.<BR><BR>See the idea? You get the number of minutes from some starting time (doesn&#039;t matter what you use, so long as it&#039;s before any of the date/time combos in your data). You divide them by 10 and then chop off the fractions. Presto.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts