> 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
{
    /** Increment the last byte of the prefix by one. But if it is max (255), then remove it and increase the previous one.
      * Example (for convenience, suppose that the maximum value of byte is `z`)
      * abcx -> abcy
      * abcz -> abd
      * zzz -> empty string
      * z -> empty string
      */
    String res = prefix;
    while (!res.empty() && static_cast<UInt8>(res.back()) == std::numeric_limits<UInt8>::max())
        res.pop_back();
    if (res.empty())
        return res;
    res.back() = static_cast<char>(1 + static_cast<UInt8>(res.back()));
    return res;
}
static void appendColumnNameWithoutAlias(const ActionsDAG::Node & node, WriteBuffer & out, bool legacy = false)
{
    switch (node.type)
    {
        case (ActionsDAG::ActionType::INPUT): [[fallthrough]];
        case (ActionsDAG::ActionType::COLUMN):
            writeString(node.result_name, out);
            break;
        case (ActionsDAG::ActionType::ALIAS):
            appendColumnNameWithoutAlias(*node.children.front(), out, legacy);
            break;
        case (ActionsDAG::ActionType::ARRAY_JOIN):
            writeCString("arrayJoin(", out);