I intend to group the “index” column in the left table according to the range of [beg_idx, end_idx) specified by the right table and sum up the values of “val“ of each group, as shown in the following figure.
I want to achieve this by using SQL statements to directly perform calculations by group, as the function group by does. How to achieve this in DolphinDB?
You can use an index to retrieve data for
sum
calculation, as shown in the following script: