sql - count hours in same column -


i'm trying query table contains employee records of presence. records employee id , datetime of chipping follows:

id  datetime 3   2015-07-01 06:58:00.000 3   2015-07-01 12:01:00.000 3   2015-07-01 12:57:00.000 3   2015-07-01 19:17:00.000 3   2015-07-02 06:55:00.000 3   2015-07-02 14:05:00.000 15  2015-07-01 07:50:00.000 15  2015-07-01 12:01:00.000 15  2015-07-01 12:50:00.000 15  2015-07-01 18:04:00.000 

i trying produce query gets

id date       entrance   exit       2entrance   2exit 3  2015-07-01 06:58      12:01    12:57       19:17 3  2015-07-02 06:55      14:05    00:00       00:00 15 2015-07-01 07:50      12:01    12:50       18:04 

but final result i'm looking is

id d1, d2, d3.. d31 3  11  7   12   6 15 9   0   6    12 

(this number of worked hours, day day, full month)

to table thinking use excel previous results, i'd apreciate if pointed me in right direction.

any appreciated.

may bit direction take date strings, split them (as have fixed format - yyyy-mm-dd_hh:mm:ss.mss). take need.

my first idea write small java service takes .txt (in wich saved earlier automatically), cuts strings , each strings give output in format need.

or looking did not involve programming?


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -