Ниже для BigQuery Standard SQL
#standardSQL
SELECT account, date,
ARRAY_AGG(sales ORDER BY data LIMIT 1)[OFFSET(0)] sales
FROM (
SELECT 'old' data, * FROM `project.dataset.old_table` UNION ALL
SELECT 'new' data, * FROM `project.dataset.new_table`
)
GROUP BY account, date
Вы можете протестировать, поиграть с приведенными выше примерами данных из вашего вопроса как
#standardSQL
WITH `project.dataset.old_table` AS (
SELECT 'Account1' account, '12-29-18' date, 10 sales UNION ALL
SELECT 'Account1', '12-30-18', 10 UNION ALL
SELECT 'Account1', '12-31-18', 5 UNION ALL
SELECT 'Account2', '12-29-18', 10 UNION ALL
SELECT 'Account3', '12-29-18', 20 UNION ALL
SELECT 'Account3', '12-30-18', 10
), `project.dataset.new_table` AS (
SELECT 'Account1' account, '12-29-18' date, 10 sales UNION ALL
SELECT 'Account1', '12-30-18', 10 UNION ALL
SELECT 'Account1', '12-31-18', 5 UNION ALL
SELECT 'Account1', '01-01-19', 20 UNION ALL
SELECT 'Account2', '12-30-18', 15 UNION ALL
SELECT 'Account2', '12-31-18', 20 UNION ALL
SELECT 'Account2', '01-01-19', 10 UNION ALL
SELECT 'Account3', '12-30-18', 10 UNION ALL
SELECT 'Account3', '12-31-18', 20 UNION ALL
SELECT 'Account3', '01-01-19', 5
)
SELECT account, date,
ARRAY_AGG(sales ORDER BY data LIMIT 1)[OFFSET(0)] sales
FROM (
SELECT 'old' data, * FROM `project.dataset.old_table` UNION ALL
SELECT 'new' data, * FROM `project.dataset.new_table`
)
GROUP BY account, date
ORDER BY account, PARSE_DATE('%m-%d-%y', date)
с результатом
Row account date sales
1 Account1 12-29-18 10
2 Account1 12-30-18 10
3 Account1 12-31-18 5
4 Account1 01-01-19 20
5 Account2 12-29-18 10
6 Account2 12-30-18 15
7 Account2 12-31-18 20
8 Account2 01-01-19 10
9 Account3 12-29-18 20
10 Account3 12-30-18 10
11 Account3 12-31-18 20
12 Account3 01-01-19 5