mysql - Calculating the sum of the table row from one table then join it with another table -
sorry,i'm not sure if i'm asking right questions want happen. have table called tbemp:
empnumber | name | value1 | value2 | value3 | e-001 | emp1 | 10 | 15 | 27 | e-001 | emp1 | 23 | 17 | 12 | e-001 | emp1 | 34 | 76 | 87 | e-007 | emp2 | 1 | 54 | 87 | e-007 | emp2 | 3 | 12 | 45 | e-007 | emp2 | 90 | 45 | 98 |
then output this:
empnumber | name | value1 | value2 | value3 | e-001 | emp1 | 67 | 108 | 126 | e-007 | emp2 | 94 | 111 | 230 |
something this
select empnumber, name, sum(value1) svalue1, sum(value2) svalue2, sum(value3) svalue3 tbemp group empnumber, name
Comments
Post a Comment