MYSQL SUM on a Column value but display all rows

  Kiến thức lập trình

I have the below Table

NAME    VAL   ID   SIG
DOE     4000  1    0
DOE     5000  8    0
JON     8000  9    1
JON     5000  9    0
DOE     1000  4    0

I need to group by NAME, SIG and create another column SUM of VALUES and show the output as

NAME    SUMVAL ID   SIG
DOE     1000   1    0
DOE     1000   8    0
JON     8000   9    1
JON     5000   9    0
DOE     1000   4    0

I tried the below command and half way through , but couldn’t get the rest working

GROUP BY SIG,NAME ```



How do I get all the rows back again like in the above output ?
    

LEAVE A COMMENT