I have two tables like this:
InfoTable
-------------------
AVNR Substation ColumnTitle S6_name AVNRString
-------------------------------------------------------------------
1129 AHWAZ-1 T3+T4 MW 1129,1134
1130 AHWAZ-1 T3+T4 MX 1130,1135
1134 AHWAZ-1 T3+T4 MW 1129,1134
1135 AHWAZ-1 T3+T4 MX 1130,1135
8906 SHOMAL T9 MW 8906
8907 SHOMAL T9 MX 8907
and
DataTable
------------------------------------------------
Pdate Ptime AVNR Wert
------------------------------------------------
03-13-2017 01:00 1129 12.65
03-13-2017 02:00 1129 25.65
03-13-2017 03:00 1129 102.05
03-12-2017 01:00 1129 12.65
03-14-2017 01:00 1129 12.65
03-16-2017 05:00 1129 12.65
03-13-2017 01:00 1134 12.65
03-13-2017 02:00 1134 25.65
03-13-2017 03:00 1130 102.05
03-12-2017 01:00 1135 11.15
03-14-2017 01:00 1130 10.00
03-16-2017 01:00 8906 24.5
03-13-2017 01:00 8906 23.5
03-16-2017 02:00 8907 22.5
03-13-2017 01:00 8907 21.5
03-16-2017 05:00 8906 12.5
03-13-2017 02:00 8907 20.5
I want to have this result
ResultTable
-------------------
Substation ColumnTitle S6_name Pdate pTime Sum_of_Wert
-------------------------------------------------------------------
AHWAZ-1 T3+T4 MW 03-13-2017 01:00 25.3 (sum of Wert for 1129,1134 for that date and time)
AHWAZ-1 T3+T4 MW 03-13-2017 02:00 51.3 (sum of Wert for 1129,1134 for that date and time)
AHWAZ-1 T3+T4 MW 03-13-2017 03:00 xxx
AHWAZ-1 T3+T4 MX 03-14-2017 01:00 xxx
SHOMAL T9 MW 03-13-2017 01:00 xxx
SHOMAL T9 MW 03-13-2017 02:00 xxx
......
i.e. I want to the sum value for Substations
that are distinguished in AvrString
for each date and time .
Is there by any chance I could do this in SQL ? I not, perhaps in Linq? I have programmed in visual studio, but this is slow. I want to know if there is any idea for that.
I am programming in c# in visual studio with sql database