1
事實表連接兩張表:
如何利用番石榴
Id Year Month countryId Sales
1 1999 1 1 3000
2 1999 2 1 2300
3 2000 3 2 3999
4 2000 4 3 2939
尺寸表:
Id country province
1 US LA
2 US CA
3 US GA
4 EN LN
我用番石榴表是這樣的:
Table<Integer, String, Object> table = Tables.newCustomTable(
Maps.<Integer, Map<String, Object>> newLinkedHashMap(),
new Supplier<Map<String, Object>>() {
public Map<String, Object> get() {
return Maps.newLinkedHashMap();
}
});
table.put(1, "Year", 1999);
table.put(1, "Month", 1);
table.put(1, "countyId", 1);
table.put(1, "Sales", 3000);
// ...... etc
table1.put(1, "county", "US");
table1.put(1, "provice", 1999);
// ......
我想要實現a LEFT JOIN
like:
1 1999 1 1 3000 US LA
2 1999 2 1 2300 US LA
3 2000 3 2 3999 US CA
4 2000 4 3 2939 EN LN
我該怎麼辦?
數據來自哪裏?它是一個數據庫嗎?是否有可能在查詢中進行連接? – maksimov
'table1.putAll(table2);'? – assylias
也許一些來自MySQL的diff數據源和另一個來自Excel - –