question

Aetos19 avatar image
Aetos19 asked

how to add data from two rows

![table1][1] ![table2][2] how to get the data from two tables like cus_id cus_name Amount (by adding the amount of each customer 1 Kishore 39 2 Praveen 70 3...... thank you in advance ![alt text][2] [1]: /storage/temp/3805-1233.jpg [2]: /storage/temp/3806-output.jpg
mysqlsql querypostgresql
1233.jpg (33.7 KiB)
output.jpg (20.7 KiB)
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Oleg avatar image Oleg commented ·
@Aetos19 By the way, the "expected output" does not appear to be correct. Kishore has 3 transactions (10, 14 and 25) so the amount for **CUS\_ID** = 1 should be 49, not 39. Praveen has 3 transactions (12, 54 and 58) so the amount for that row should be 124, not 70. Are you really trying to combine the data from just 2 transaction rows or from all transaction rows per each customer?
1 Like 1 ·
JohnM avatar image JohnM commented ·
What have you tried thus far? If you post your query we can probably help you get you in the right direction.
0 Likes 0 ·

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.