Hello and Good day,
I am a new beginner. I have this challenge in C# and would appreciate if anyone can help me out. I have three tables as described belo;
TABLE A
VehN, Dst, TrpM
TABLE B
VehN
TABLE c
VehN, Tot_Dst
TABLE A DATA
VehN Dst TrpM
UYO123CDF, 2000, OCT
PHC456ABU, 150, OCT
ERT678SER, 250, OCT
ERT678SER, 1500, OCT
UYO123CDF, 501, OCT
KUU8376G, 83155, SEP
KUU8376G, 1500, OCT
LAG123EKY, 3100, OCT
KUU8376G, 601, OCT
PHC456ABU, 500, OCT
PHC456ABU, 801, OCT
TABLE B DATA
VehN
UYO123CDF
PHC456ABU
ERT678SER
KUU8376G
LAG123EKY
I want TABLE C to be updated as sum(table-A.Dst) where first data in Table-B = Table-A.VehN and where Table-A.TrpM = 'OCT' This should continue untill Table-B end of file.
Table C will now look like this
VehN, Tot_Dst
UYO123CDF, 2,501
PHC456ABU, 1,451
ERT678SER, 1,750
KUU8376G, 2,101
LAG123EKY, 3,100
I will need a c# code and SQL command that will enable me achieve what I described above.
Olabode