Below is my database table
Product Id IsPrimary Quantity
P001 1
P001.1 0 2
P001.2 0 4
P001.3 0 5
P002 1
P002.1 0 6
P002.2 0 7
P002.3 0 9
P002.4 0 10
P002.5 0 11
Need the query for result each group shows multiplied value of group quantity and last row of the group is shown with NULL
Product Id SubProduct Quantity
P001 40
P001 P001.3 NULL
P002 41580
P002 P002.5 NULL
ShanmugaRaj