**How to reproduce**
Tested on Clickhouse server version 20.4.6 revision 54434.

Given setup:
```sql
create table main(date Date, user UInt32, data UInt32) engine=Memory();
create table j1(date Date, thing UInt32) engine=Memory();
create table j2(date Date, thing UInt32) engine=Memory();
```

The following query works:
```sql
select
    main.date,
    user
from main
join j1 on main.user=j1.thing
```

But the following query fails:
```sql
select
    main.date,
    user
from main
join j1 on main.user=j1.thing
join j2 on main.data=j2.thing
```
With:
```
DB::Exception: Missing columns: 'user' while processing query: 'SELECT `--main.date` AS `main.date`, user FROM (SELECT * FROM main INNER JOIN j1 ON `--main.user` = `--j1.thing`) AS `--.s` ALL INNER JOIN (SELECT * FROM j2) AS j2 ON `--main.data` = thing', required columns: '--main.date' '--main.data' 'user' 'thing', source columns: '--j1.thing' 'j1.date' '--main.data' '--main.user' '--main.date', joined columns: 'date' 'thing'.
```

The query does work if I explicitly change `user` to `main.user` in the SELECT clause.

Since `user` is not an ambiguous column and joining `j2` doesn't have anthing to do with the `user` column, I'd expect my query to not break when adding the second join.
\
    M(SettingMilliseconds, insert_in_memory_parts_timeout, 600000, "", 0) \
    \
    M(SettingUInt64, replication_alter_partitions_sync, 1, "Wait for actions to manipulate the partitions. 0 - do not wait, 1 - wait for execution only of itself, 2 - wait for everyone.", 0) \
    M(SettingUInt64, replication_alter_columns_timeout, 60, "Wait for actions to change the table structure within the specified number of seconds. 0 - wait unlimited time.", 0) \
    \
    M(SettingLoadBalancing, load_balancing, LoadBalancing::RANDOM, "Which replicas (among healthy replicas) to preferably send a query to (on the first attempt) for distributed processing.", 0) \
    \
    M(SettingTotalsMode, totals_mode, TotalsMode::AFTER_HAVING_EXCLUSIVE, "How to calculate TOTALS when HAVING is present, as well as when max_rows_to_group_by and group_by_overflow_mode = ‘any’ are present.", IMPORTANT) \
    M(SettingFloat, totals_auto_threshold, 0.5, "The threshold for totals_mode = 'auto'.", 0) \
    \
    M(SettingBool, allow_suspicious_low_cardinality_types, false, "In CREATE TABLE statement allows specifying LowCardinality modifier for types of small fixed size (8 or less). Enabling this may increase merge times and memory consumption.", 0) \
    M(SettingBool, compile_expressions, false, "Compile some scalar functions and operators to native code.", 0) \
    M(SettingUInt64, min_count_to_compile_expression, 3, "The number of identical expressions before they are JIT-compiled", 0) \
    M(SettingUInt64, group_by_two_level_threshold, 100000, "From what number of keys, a two-level aggregation starts. 0 - the threshold is not set.", 0) \
    M(SettingUInt64, group_by_two_level_threshold_bytes, 100000000, "From what size of the aggregation state in bytes, a two-level aggregation begins to be used. 0 - the threshold is not set. Two-level aggregation is used when at least one of the thresholds is triggered.", 0) \
    M(SettingBool, distributed_aggregation_memory_efficient, false, "Is the memory-saving mode of distributed aggregation enabled.", 0) \
    M(SettingUInt64, aggregation_memory_efficient_merge_threads, 0, "Number of threads to use for merge intermediate aggregation results in memory efficient mode. When bigger, then more memory is consumed. 0 means - same as 'max_threads'.", 0) \
    \
    M(SettingUInt64, max_parallel_replicas, 1, "The maximum number of replicas of each shard used when the query is executed. For consistency (to get different parts of the same partition), this option only works for the specified sampling key. The lag of the replicas is not controlled.", 0) \
    M(SettingUInt64, parallel_replicas_count, 0, "", 0) \
    M(SettingUInt64, parallel_replica_offset, 0, "", 0) \
    \
    M(SettingSpecialSort, special_sort, SpecialSort::NOT_SPECIFIED, "Specifies a sorting algorithm which will be using in ORDER BY query.", 0) \
    \
    M(SettingBool, skip_unavailable_shards, false, "If 1, ClickHouse silently skips unavailable shards and nodes unresolvable through DNS. Shard is marked as unavailable when none of the replicas can be reached.", 0) \
    \
    M(SettingBool, distributed_group_by_no_merge, false, "Do not merge aggregation states from different servers for distributed query processing - in case it is for certain that there are different keys on different shards.", 0) \
    M(SettingBool, parallel_distributed_insert_select, false, "If true, distributed insert select query in the same cluster will be processed on local tables on every shard", 0) \
    M(SettingBool, optimize_distributed_group_by_sharding_key, false, "Optimize GROUP BY sharding_key queries (by avodiing costly aggregation on the initiator server).", 0) \