InverseOfNeo
Diamond Member
I want to iterate though an entire table of id numbers and amounts so for each id number it adds up the amounts to give a total for each id. Then I want to display the persons name and credit card number from the id. Here's my tables (I've left out extraneous columns):
The output I want is:
id name creditcardnumber total
For each id in table2, there may be multiple or one or no records for it in table1. Table structure doesn't matter that much here, so I could add another column to table2 for the total if this would be easier. I hope this makes sense.
Code:
table1
id amount
table2
id name creditcardnumber
id name creditcardnumber total
For each id in table2, there may be multiple or one or no records for it in table1. Table structure doesn't matter that much here, so I could add another column to table2 for the total if this would be easier. I hope this makes sense.
Last edited: