Question

Update query to sum values from different rows into one row in a different table

  • 21 February 2022
  • 1 reply
  • 28 views

Badge +5

Hi.,

 

I'm trying to write an update query to add the values from multiple rows to one row and update in a different table. But no luck. Need your help on this. I'm using V11 version. Below is the example

image 

Expected output

 

imageBot to use the Table 2 values with unique Employee ID and match it with Table 1. It should all the total values of that Employee ID and write in one row in Output table

 

Thanks

 


1 reply

Userlevel 3
Badge +7

Hi @vanithar Vanthat​ ,

 

I don't think an UPDATE clause is what you are looking for here, because you can't update an existing table with lesser columns.

 

I've stored dummy values inside Excel for testing and came up with this SQL query:

 

SELECT [Employee ID], SUM([Total]) as Total

FROM [Sheet1$$]

GROUP BY [Employee ID];

 

imageIf this is not what you were looking for, we would appreciate it if you could add some more details.

 

Kind Regards,

Ashwin A.K

Reply