Hi. This is my first post, so, please, bear with me.
I have two tables:
FIRST:
SECOND:
I would like, if possible, to insert values from the second table into the first on, according to "Data" field from both. The trick is that, the second table contains less rows and different dates than the first one.
Ex: TABLE 2 - Sum(ROW 1,2,3) --> TABLE 1 - ROW 1
TABLE 2 - ROW 4 --> TABLE 1 - ROW 7
TABLE 2 - Sum(ROW 5,6) --> TABLE 1 - ROW 12
... and so on.
The question is: can I do that with SQL or with VBA?
I have two tables:
FIRST:
Code:
[B][U]ID[/U] [U]DataEmitere[/U] [U]DispIO[/U][/B] 1 19.10.2011 0,00 2 19.10.2011 0,00 3 19.10.2011 0,00 4 19.10.2011 0,00 5 19.10.2011 0,00 6 19.10.2011 0,00 7 24.10.2011 0,00 8 24.10.2011 0,00 9 24.10.2011 0,00 10 24.10.2011 0,00 11 24.10.2011 0,00 12 31.10.2011 0,00 13 31.10.2011 0,00 14 14.11.2011 0,00 15 14.11.2011 0,00 16 18.11.2011 0,00 17 18.11.2011 0,00 18 18.11.2011 0,00 19 18.11.2011 0,00 20 23.11.2011 0,00 21 23.11.2011 0,00 22 23.11.2011 0,00 23 23.11.2011 0,00 24 29.11.2011 0,00 25 29.11.2011 0,00 26 30.11.2011 0,00 27 06.12.2011 0,00 28 09.12.2011 0,00 29 09.12.2011 0,00 30 09.12.2011 0,00 31 09.12.2011 0,00 32 09.12.2011 0,00 33 13.12.2011 0,00 34 13.12.2011 0,00 35 15.12.2011 0,00 36 15.12.2011 0,00 37 15.12.2011 0,00 38 15.12.2011 0,00 39 22.12.2011 0,00 40 22.12.2011 0,00
Code:
[B][U]ID[/U] [U]Data[/U] [U]Suma[/U][/B] 1 01.10.2011 17.027,76 lei 2 14.10.2011 4.121,00 lei 3 19.10.2011 5.355,00 lei 4 24.10.2011 3.645,00 lei 5 26.10.2011 4.964,00 lei 6 31.10.2011 3.402,00 lei 7 14.11.2011 2.196,00 lei 8 18.11.2011 8.844,00 lei 9 23.11.2011 5.122,00 lei 10 29.11.2011 8.829,00 lei 11 13.12.2011 4.050,00 lei 12 15.12.2011 3.700,00 lei 13 21.12.2011 6.162,00 lei 14 22.12.2011 3.260,00 lei
Ex: TABLE 2 - Sum(ROW 1,2,3) --> TABLE 1 - ROW 1
TABLE 2 - ROW 4 --> TABLE 1 - ROW 7
TABLE 2 - Sum(ROW 5,6) --> TABLE 1 - ROW 12
... and so on.
The question is: can I do that with SQL or with VBA?
Comment