Hi I need another Help

Hi I need another Help
SQL Table one Field i have Hours

User 1 = 01:30
User 1 = 00: 45
User 2 = 02:25
User 2 = 01.55

My Question
I Need Total for Each User (How many Total hours)
What is the SQL Query ?

Can Someone help me please. thanks

Comments

  1. Hi Sir,
    Thanks for your reply, i have done following code

    Select EMPID, Sum(OTH) As OTHF From EmpAttandance
    Group by EMPID

    i am getting following Error

    Msg 8117, Level 16, State 1, Line 1
    Operand data type time is invalid for sum operator.

    ReplyDelete
  2. Jude De Silva you didn't mention which database you're using, but it looks like it cannot sum times. Your dbms sucks :) Well, convert times to seconds, and sum those instead. How to concert times to seconds depends on your database.

    ReplyDelete
  3. If its mysql (i doubt that because of the error message) you can use something like time_to_sec() or something like unix_timestamp.

    ReplyDelete

Post a Comment