Re: Newbie SQL question

From: Robert M Sampson <sampsonr_at_ncr.disa.mil>
Date: 1996/11/15
Message-ID: <328d819e.595854072_at_news.spry.com>#1/1


purcell_at_iag.net wrote:

>I am relatively new to SQL so this is probably a simplistic question.
>
>I have a table with each record containing a number value representing
>seconds. I want to be able to sum all seconds and display it in the
>format HH:MM:SS for the summed number of seconds. The format needs to
>zero pad the hours, minutes and seconds if it is only 1 digit.
>
>
How about adding up the seconds, dividing the result by 86400 (seconds in a day) and converting to a date and then to a char representation.

	select    to_char((to_date((sum(secs))/86400),'HH24:MI:SS) 
	from A
	group by secs;
Received on Fri Nov 15 1996 - 00:00:00 CET

Original text of this message