> Make sure to check documentation https://clickhouse.com/docs/en/ first. If the question is concise and probably has a short answer, asking it in Telegram chat https://telegram.me/clickhouse_en is probably the fastest way to find the answer. For more complicated questions, consider asking them on StackOverflow with "clickhouse" tag https://stackoverflow.com/questions/tagged/clickhouse 

> If you still prefer GitHub issues, remove all this text and ask your question here.

sql【1】:  
`select count()
from (
         SELECT event_dt
         FROM (select event_dt, 403 AS event_id
               from (
                        select event_dt
                        from tba as tba
                        where event_id = 9
                          and ((tba.event_dt >= 20220822 and tba.event_dt <= 20220822))
                        )) tba
         WHERE tba.event_dt >= 20220822
           and tba.event_dt <= 20220822
         );`

sql【2】:
`select count()
from (
         SELECT event_dt
         FROM (select event_dt, 403 AS event_id
               from (
                        select event_dt
                        from tba as tba
                        where event_id = 9
                          and ((tba.event_dt >= 20220822 and tba.event_dt <= 20220822))
                        )) tba
         WHERE tba.event_dt >= 20220822
           and tba.event_dt <= 20220822
           and event_id = 403
         );`

why sql【2】result less data
}
                else
                {
                    DataTypePtr common_type = tryGetLeastSupertype(DataTypes{key_expr_type_not_null, const_type});
                    if (!common_type)
                        return false;
                    if (!const_type->equals(*common_type))
                    {
                        castValueToType(common_type, const_value, const_type, node);
                        
                        if (!key_expr_type_not_null->equals(*common_type))
                            is_constant_transformed = true;
                    }
                    if (!key_expr_type_not_null->equals(*common_type))
                    {
                        auto common_type_maybe_nullable = (key_expr_type_is_nullable && !common_type->isNullable())
                            ? DataTypePtr(std::make_shared<DataTypeNullable>(common_type))
                            : common_type;
                        ColumnsWithTypeAndName arguments{
                            {nullptr, key_expr_type, ""},
                            {DataTypeString().createColumnConst(1, common_type_maybe_nullable->getName()), common_type_maybe_nullable, ""}};
                        FunctionOverloadResolverPtr func_builder_cast = CastInternalOverloadResolver<CastType::nonAccurate>::createImpl();
                        auto func_cast = func_builder_cast->build(arguments);
                        
                        if (!single_point && !func_cast->hasInformationAboutMonotonicity())
                            return false;
                        chain.push_back(func_cast);
                    }
                }
            }