I have data in the following format in a table:
Acct# Amount
123 3.4
123T 4.5
124 2.3
124T 4.5
125 1.2
125T 2.4
How do I create a select statement where it totals up the account number as 123+123T and gives the following output:
123 7.9
124 6.8
125 3.6
You don’t say any particular dialect of SQL
Or to handle arbitrary length account numbers
Or a more generic approach that will handle arbitrary mappings might be to construct a mapping table that you can then join on. There is quite a lot of missing information here as to the rules that need to be applied!