> 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
{
            left_args_count = left_arg_tuple.numArguments();
            for (size_t i = 0; i < left_args_count; ++i)
                get_key_tuple_position_mapping(left_arg_tuple.getArgumentAt(i), i);
        }
        else
            get_key_tuple_position_mapping(left_arg, 0);
    }
    else
        get_key_tuple_position_mapping(left_arg, 0);
    if (indexes_mapping.empty())
        return false;
    const auto right_arg = func.getArgumentAt(1);
    auto prepared_set = right_arg.tryGetPreparedSet(prepared_sets, indexes_mapping, data_types);
    if (!prepared_set)
        return false;
    
    if (!prepared_set->hasExplicitSetElements())
        return false;
    prepared_set->checkColumnsNumber(left_args_count);
    for (size_t i = 0; i < indexes_mapping.size(); ++i)
        prepared_set->checkTypesEqual(indexes_mapping[i].tuple_index, data_types[i]);
    out.set_index = std::make_shared<MergeTreeSetIndex>(prepared_set->getSetElements(), std::move(indexes_mapping));
    return true;
}
/** Allow to use two argument function with constant argument to be analyzed as a single argument function.
  * In other words, it performs "currying" (binding of arguments).
  * This is needed, for example, to support correct analysis of `toDate(time, 'UTC')`.
  */
class FunctionWithOptionalConstArg : public IFunctionBase