Home
Top.Mail.Ru Yandeks.Metrika
Forum: "Bases";
Current archive: 2002.01.08;
Download: [xml.tar.bz2];

Down

Column Sum Pro Find similar branches


SklifF   (2001-12-03 19:08) [0]

There are 3 columns 1: hours, 2: minutes, 3 seconds
What is the best way to make a request so that it performs a summation of all three columns line by line, but taking into account that in minutes 60 seconds, etc.

Please help



Dick Gonsales   (2001-12-04 04:25) [1]

SELECT
(SUM (CONVERT (NUMERIC (2,0), (f_hour))) * 3600 +
SUM (CONVERT (NUMERIC (2,0), (f_min))) * 60 +
SUM (CONVERT (NUMERIC (2,0), (f_sec)))
) as sec_time
FROM tmp_time

so you get the total number of seconds
they already lead to the familiar form yy-mm-dd hh: mm: ss
using a party procedure through the remainder
integer division, Sybase supports these functions




unfam   (2001-12-04 04:27) [2]

You mean like this:
select sum (1) * 3600, sum (2) * 60, sum (3) from ... or not?



Dick Gonsales   (2001-12-04 04:51) [3]

Re unfam
Not really, but the meaning is true
You get
total hours in seconds, total minutes in seconds, total seconds in seconds
it will then have to be summarized anyway for human translation
in kind
"Total time spent -"
1 year 2 months 20 days 23 hours 10 minutes 34 seconds
And I suggest immediately getting the total number of seconds for the server
it doesn’t strain, and then it’s more convenient to process it.

In general, you can pervert and count it all in and in SELECT,
but the bells and whistles are crazy and will work many times longer.
It's easier to write such a SELECT and a procedure that
turns the number of seconds into yy-mm-dd hh: mm: ss




unfam   (2001-12-04 09:21) [4]

> Dick Gonsales. Yes, I already looked at your answer :)



MVova   (2001-12-04 10:32) [5]

And the question then sounds "line by line"



MVova   (2001-12-04 10:34) [6]

Much more suitable
select 4 = (sum (1) * 3600 + sum (2) * 60 + sum (3)) from ...



SklifF   (2001-12-04 10:54) [7]

Thank you very much for the tips.



Pages: 1 whole branch

Forum: "Bases";
Current archive: 2002.01.08;
Download: [xml.tar.bz2];

Top





Memory: 0.56 MB
Time: 0.026 c
1-22045
Socol
2001-12-15 17:14
2002.01.08
Write to file.


14-22333
Nikolay
2001-11-03 20:12
2002.01.08
$$$$$$$$$$$$$$$$$$$$$$$$$$


6-22312
Leviathan
2001-10-15 00:24
2002.01.08
Hey, who knows about Indy? Help is needed!


1-22232
T2
2001-12-16 07:24
2002.01.08
WIN386.SWP


4-22498
cher_gvf
2001-11-05 20:12
2002.01.08
How do you know if such a process is running?





afrikaans albanian Arabic armenian azerbaijani basque belarusian bulgarian catalan Chinese (Simplified) Chinese (Traditional) croatian Czech danish Dutch English estonian filipino finnish French
galician georgian German greek haitian Creole hebrew Hindi hungarian icelandic indonesian Irish italian Japanese Korean latvian lithuanian macedonian malay maltese norwegian
persian polish portuguese Romanian russian serbian slovak Slovenian Spanish swahili Swedish thai turkish Ukrainian urdu vietnamese welsh yiddish bengali bosnian
cebuano Esperanto gujarati hausa hmong igbo javanese kannada Khmer lao latin maori marathi mongolian nepali punjabi somali tamil telugu yoruba
zulu
English French German Italian Portuguese Russian Spanish