Skip to content
Advertisement

sql- suppressing the amount value to get the unique value when its multiple rows of same information

Sorry for the confused title.

I am on Teradata 16.1, I have two tables, one is a simple table with id and amount and another one is a detailed table with sub id’s and their amounts. In the second table the amounts are splits of the sub id’s which makes up the amount of id’s.

When Joining these tables the table A amount is getting repeated ( which is obvious ), but I need to get it only once so that I can reconcile that amount to other tables.Thinking of two solutions ( and open to others as well) but dont know how to achieve in sql. Its all in the Image.

Any insights?

enter image description here

Advertisement

Answer

You can number rows from sub_table to identify the 1st and hide main_table amount on others

result

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement