I paste this table from excel to access
Table 1
Code:
Fruit|freq
Apples|7
Bananas|10
Grapes|4
Strawberries|3
Then after a while I came up with another table looking like this:
Table 2
Code:
Fruit|freq
Marshmallows|5
Grapes|8
Prunes|2
Strawberries|3
Note that Grapes repeat in both tables.
I want to JOIN THE TWO TABLES in a single table, or to mix them together, to unify them, union, or to merge them, however it's properly called in MS Acces.
result:
Code:
Fruit|Table1|Table2|TOTAL
Apples|7||7
Bananas|10||10
Grapes|4|8|12
Marshmallows||5|5
Prunes||2|2
Strawberries|3||3
Fruit names, don't repeat, and look at grapes entry.
I've managed to do this with a pivot table in excel, but I'm interested in millions of entries, so I can't use excel because of its limit of 2 millions of rows.
Then I progressively update this end result table with similar tables. (New entries may occur)
Table 3
Code:
Fruit|freq
Oranges|3
Lemons|9
Kiwifruits|4
Bananas|2
Blueberries|1
now my updated table looks like this:
Code:
Fruit|Table1|Table2|Table3|TOTAL
Apples|7|||7
Bananas|10||2|12
Blueberries|||1|1
Grapes|4|8||12
Kiwifruits|||4|4
Lemons|||9|9
Marshmallows||5||5
Prunes||2||2
Oranges|||3|3
Strawberries|3|||3
I want this result to become a new table, so that I can freely delete table1, table2 and table3 from my database to be left only with this end result table. Then the process continues forever where I again paste a new table4 from excel, that I want it to be merged/union/mixed/joined into this big one.
I'm a beginner in SQL, but I found a SQL Union Query code, on a site, after i tweak it a little bit, I manually join first 2 table and I try the code:
Code:
select fruit, NULL AS table1, NULL AS table2, freq
from table3
UNION
select fruit, table1, table2, NULL AS table3
from table1
but it doesn't work
, and a ? symbol appear instead of numbers, I think because It can't join cells that are declared as null with cells that are numeric/numbers,
and even if it worked I would have to change the code for every new future merging of tables.
How do I do this? With query design, make table ? Please, someone help me find a solution...
And if I don't upset anybody with my long/boring post, I have another problem. For reasons of space, and archiving/compressing all my data into a single table, I'm looking at something like let's say 10 millions of rows by 2000 column. Now the problem that I will probably be confronted with is the speed of operating with such a large single table. The question is: Is it faster, or more recommended to leave these tables (table1, table2, table3) individually separated, in my database, and each time I require to view a total freq of all the fruits in all the tables, run a query, a report or something?