Time studies
Posted in 1997
Pat I doubt you will be able to do this directly in sql (unless a stored procedure can provide the functionality). You will need to use the EXTEND function to extract the hours and minutes from the datetime. EXTEND(datetime_field, HOUR TO HOUR) EXTEND(datetime_field, MINUTE TO MINUTE) To get 2 new values that you will need to assign to smallints. Taking the 5 mins example, calculate the 'group' value by using dividing mins by 5 and save the result in an integer. Let groupmins = mins / 5 At this point you can either store the resulting records with the calculated values in a temp table, or use a 4GL report with the 2 calculated columns as groupings. If you need to display the results in a report you are more or less finished. Mark MarkDenham@aol.com (home) Denham.M@amstr.com (work) --------------------------( Forwarded letter 1 follows )--------------------- Date: Thursday, 5 June 1997 1:47pm From: "Pat O'Connor" <poconnor@internetmci.com> Subject: Time studies Date: 5 Jun 1997 19:19:27 GMT Reply-To: poconnor@internetmci.com Organization: - Sender: informix-list-owner@rmy.emory.edu To: informix-list@rmy.emory.edu X-Informix-List-Id: <news.38815> 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