Subin Thomas

Subin Thomas

  • NA
  • 4.9k
  • 127.1k

sql query related !

Mar 26 2019 4:00 AM
i have a table like below

 name1 name2 amount1 amount2
 aa 111 100 200
 aa 111 200 300
 aa 111 0 100
 aa 111 250 350
 bb 222 150 0
 bb 222 300 400
 cc 333 0 200
 cc 333 350 0
 
here the name aa is repeated also 111 but the amounts are not repeated it is different
  i want the repetative names as one record and the amount should be the sum
 
for eg i want the above table as the below table
 
name1name2amount1amount2
aa111550 950
bb222 450400
cc33350  200

Answers (6)