**How to reproduce**
* Which ClickHouse server version to use
latest master/arcadia
* Non-default settings, if any
```sql
SET prefer_localhost_replica=0
```
(With a local stream the query works fine)
* `CREATE TABLE` statements for all tables involved
```sql
create table "t0" (a Int64, b Int64) engine = MergeTree() partition by a order by a;
create table "dist_t0" (a Int64, b Int64) engine = Distributed(test_shard_localhost, default, t0);
```
* Sample data for all these tables
```sql
insert into t0 values (0, 0);
```
* Queries to run that lead to unexpected result
```sql
di.man.yp-c.yandex.net :) SELECT a / (SELECT sum(number) FROM numbers(10)) FROM dist_t0

SELECT a / 
    (
        SELECT sum(number)
        FROM numbers(10)
    )
FROM dist_t0

Query id: 27b16db2-ad76-403c-8ac1-c03bfb9b0daf


0 rows in set. Elapsed: 0.020 sec. 

Received exception from server (version 21.5.1):
Code: 10. DB::Exception: Received from localhost:9000. DB::Exception: Not found column divide(a, _subquery4) in block. There are only columns: divide(a, CAST(45, 'UInt64')): While executing Remote.
```

#include <Common/typeid_cast.h>
#include <Interpreters/QueryAliasesVisitor.h>
#include <Parsers/ASTTablesInSelectQuery.h>
#include <Parsers/ASTSelectWithUnionQuery.h>
#include <Parsers/ASTSelectQuery.h>
#include <Parsers/formatAST.h>
#include <Parsers/ASTSubquery.h>
#include <Common/quoteString.h>
namespace DB
{
namespace ErrorCodes
{
    extern const int MULTIPLE_EXPRESSIONS_FOR_ALIAS;
}
static String wrongAliasMessage(const ASTPtr & ast, const ASTPtr & prev_ast, const String & alias)
{
    WriteBufferFromOwnString message;
    message << "Different expressions with the same alias " << backQuoteIfNeed(alias) << ":\n";
    formatAST(*ast, message, false, true);
    message << "\nand\n";
    formatAST(*prev_ast, message, false, true);
    message << '\n';
    return message.str();
}
bool QueryAliasesWithSubqueries::needChildVisit(const ASTPtr & node, const ASTPtr &)