**Describe the unexpected behaviour**

The column resolution seems to resolve an alias to the wrong column when there is a left join in the query.

**How to reproduce**
* Which ClickHouse server version to use: `20.3.12.112`
* Which interface to use, if matters: HTTP Interface (but should not matter)

Please run the following queries:
```sql
-- Tables
CREATE TABLE default.tableConversion (
	conversionId String,
	value Nullable(Double)
) ENGINE = Log();

CREATE TABLE default.tableClick (
	clickId String,
	conversionId String,
	value Nullable(Double)
) ENGINE = Log();

CREATE TABLE default.leftjoin (
	id String
) ENGINE = Log();

-- Values
INSERT INTO default.tableConversion(conversionId, value) VALUES ('Conversion 1', 1);
INSERT INTO default.tableClick(clickId, conversionId, value) VALUES ('Click 1', 'Conversion 1', 14);
INSERT INTO default.tableClick(clickId, conversionId, value) VALUES ('Click 2', 'Conversion 1', 15);
INSERT INTO default.tableClick(clickId, conversionId, value) VALUES ('Click 3', 'Conversion 1', 16);

-- Query
SELECT
	conversion.conversionId as myConversionId,
	click.clickId as myClickId,
	click.myValue as myValue
FROM (
	SELECT conversionId, value as myValue
	FROM default.tableConversion
) as conversion
INNER JOIN (
	SELECT clickId, conversionId, value as myValue
	FROM default.tableClick
) as click ON click.conversionId = conversion.conversionId
LEFT JOIN (
	SELECT * FROM default.leftjoin
) as dummy on (dummy.id = conversion.conversionId)
```

**Expected behavior**
The values in the `myValue` column should be 14, 15 and 16.

**Actual behaviour**
The values in the `myValue` column is 1.

This means, that the colum `click.myValue as myValue` gets resolved as `conversion.myValue`. Please notice that the source table has been changed!

**Additional context**

The behaviour is only visible when there is a `LEFT JOIN` in the Query. Referencing the `leftjoin` table in the `SELECT` statement does not change the result. **Leaving the `LEFT JOIN` out of the query makes it return the correct results.**

M(SettingBool, input_format_values_accurate_types_of_literals, true, "For Values format: when parsing and interpreting expressions using template, check actual type of literal to avoid possible overflow and precision issues.", 0) \
    M(SettingBool, input_format_avro_allow_missing_fields, false, "For Avro/AvroConfluent format: when field is not found in schema use default value instead of error", 0) \
    M(SettingURI, format_avro_schema_registry_url, {}, "For AvroConfluent format: Confluent Schema Registry URL.", 0) \
    \
    M(SettingBool, output_format_json_quote_64bit_integers, true, "Controls quoting of 64-bit integers in JSON output format.", 0) \
    \
    M(SettingBool, output_format_json_quote_denormals, false, "Enables '+nan', '-nan', '+inf', '-inf' outputs in JSON output format.", 0) \
    \
    M(SettingBool, output_format_json_escape_forward_slashes, true, "Controls escaping forward slashes for string outputs in JSON output format. This is intended for compatibility with JavaScript. Don't confuse with backslashes that are always escaped.", 0) \
    \
    M(SettingUInt64, output_format_pretty_max_rows, 10000, "Rows limit for Pretty formats.", 0) \
    M(SettingUInt64, output_format_pretty_max_column_pad_width, 250, "Maximum width to pad all values in a column in Pretty formats.", 0) \
    M(SettingUInt64, output_format_pretty_max_value_width, 10000, "Maximum width of value to display in Pretty formats. If greater - it will be cut.", 0) \
    M(SettingBool, output_format_pretty_color, true, "Use ANSI escape sequences to paint colors in Pretty formats", 0) \
    M(SettingString, output_format_pretty_grid_charset, "UTF-8", "Charset for printing grid borders. Available charsets: ASCII, UTF-8 (default one).", 0) \
    M(SettingUInt64, output_format_parquet_row_group_size, 1000000, "Row group size in rows.", 0) \
    M(SettingString, output_format_avro_codec, "", "Compression codec used for output. Possible values: 'null', 'deflate', 'snappy'.", 0) \
    M(SettingUInt64, output_format_avro_sync_interval, 16 * 1024, "Sync interval in bytes.", 0) \
    M(SettingBool, output_format_tsv_crlf_end_of_line, false, "If it is set true, end of line in TSV format will be \\r\\n instead of \\n.", 0) \
    \
    M(SettingUInt64, input_format_allow_errors_num, 0, "Maximum absolute amount of errors while reading text formats (like CSV, TSV). In case of error, if at least absolute or relative amount of errors is lower than corresponding value, will skip until next line and continue.", 0) \
    M(SettingFloat, input_format_allow_errors_ratio, 0, "Maximum relative amount of errors while reading text formats (like CSV, TSV). In case of error, if at least absolute or relative amount of errors is lower than corresponding value, will skip until next line and continue.", 0) \
    \
    M(SettingString, format_schema, "", "Schema identifier (used by schema-based formats)", 0) \
    M(SettingString, format_template_resultset, "", "Path to file which contains format string for result set (for Template format)", 0) \
    M(SettingString, format_template_row, "", "Path to file which contains format string for rows (for Template format)", 0) \
    M(SettingString, format_template_rows_between_delimiter, "\n", "Delimiter between rows (for Template format)", 0) \
    \
    M(SettingString, format_custom_escaping_rule, "Escaped", "Field escaping rule (for CustomSeparated format)", 0) \
    M(SettingString, format_custom_field_delimiter, "\t", "Delimiter between fields (for CustomSeparated format)", 0) \