Re: Time studies
Posted in 1997
>I have a number of rows in a table that contain a column defined as: >datetime hour to minute >I want to be able to count the number of rows (total the dollars) in a 5-minute increment (or any other minutes increment). >I have Informix SE 4.1 with ISQL & R4GL. >Can anyone help me with query syntax? >TIA >Pat O'Connor Try this: SELECT SUM(row_to_sum) FROM your_table WHERE time_column BETWEEN (CURRENT - INTERVAL (5) MINUTE TO MINUTE) AND CURRENT Or for a hard coded date, try, SELECT SUM(row_to_sum) FROM your_table WHERE time_column <= DATETIME (1997-06-06 09:50) YEAR TO MINUTE and time_column >= (DATETIME (1997-06-06 09:50) YEAR TO MINUTE - INTERVAL (5) MINUTE to MINUTE) I have INFORMIX Online 7.11.UC1 and this works for me. Bruce Farwell Spartan Stores, Inc. Grand Rapids, MI