Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
ClickHouse launches Claude-powered Agents and House Mates partner program at Open House 2026 Read more →
选择最后遇到的值,类似于 anyLast,但可以接受 NULL。
anyLast
CREATE TABLE test_data ( a Int64, b Nullable(Int64) ) ENGINE = Memory; INSERT INTO test_data (a, b) VALUES (1,null), (2,3), (4, 5), (6,null)
SELECT last_value(b) FROM test_data
┌─last_value_ignore_nulls(b)─┐ │ 5 │ └────────────────────────────┘
SELECT last_value(b) ignore nulls FROM test_data
SELECT last_value(b) respect nulls FROM test_data
┌─last_value_respect_nulls(b)─┐ │ ᴺᵁᴸᴸ │ └─────────────────────────────┘
ORDER BY
SELECT last_value_respect_nulls(b), last_value(b) FROM ( SELECT * FROM test_data ORDER BY a ASC )
┌─last_value_respect_nulls(b)─┬─last_value(b)─┐ │ ᴺᵁᴸᴸ │ 5 │ └─────────────────────────────┴───────────────┘
此页面对您有帮助吗?