mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
parent
4f63af957d
commit
935b943703
@ -0,0 +1,20 @@
|
||||
--------
|
||||
0 1 x=0
|
||||
1 0 x<>0
|
||||
3 0 x<>0
|
||||
\N \N x<>0
|
||||
--------
|
||||
2020-01-01 2 0 leave
|
||||
2020-01-02 aaa 0 1 delete
|
||||
2020-01-03 2 0 leave
|
||||
2020-01-04 2 0 leave
|
||||
2020-01-05 \N 2 0 leave
|
||||
2020-01-06 aaa 0 1 delete
|
||||
2020-01-07 aaa 0 1 delete
|
||||
2020-01-08 aaa \N \N leave
|
||||
--------
|
||||
2020-01-01 2
|
||||
2020-01-03 2
|
||||
2020-01-04 2
|
||||
2020-01-05 \N 2
|
||||
2020-01-08 aaa \N
|
@ -0,0 +1,26 @@
|
||||
select '--------';
|
||||
SELECT arrayJoin([0, 1, 3, NULL]) AS x, x = 0, if(x = 0, 'x=0', 'x<>0') ORDER BY x;
|
||||
|
||||
select '--------';
|
||||
drop table if exists mutation_delete_null_rows;
|
||||
|
||||
CREATE TABLE mutation_delete_null_rows
|
||||
(
|
||||
`EventDate` Date,
|
||||
`CounterID` Nullable(String),
|
||||
`UserID` Nullable(UInt32)
|
||||
)
|
||||
ENGINE = MergeTree()
|
||||
ORDER BY EventDate;
|
||||
|
||||
INSERT INTO mutation_delete_null_rows VALUES ('2020-01-01', '', 2)('2020-01-02', 'aaa', 0);
|
||||
INSERT INTO mutation_delete_null_rows VALUES ('2020-01-03', '', 2)('2020-01-04', '', 2)('2020-01-05', NULL, 2)('2020-01-06', 'aaa', 0)('2020-01-07', 'aaa', 0)('2020-01-08', 'aaa', NULL);
|
||||
|
||||
SELECT *,UserID = 0 as UserIDEquals0, if(UserID = 0, 'delete', 'leave') as verdict FROM mutation_delete_null_rows ORDER BY EventDate;
|
||||
|
||||
ALTER TABLE mutation_delete_null_rows DELETE WHERE UserID = 0 SETTINGS mutations_sync=1;
|
||||
|
||||
select '--------';
|
||||
SELECT * FROM mutation_delete_null_rows ORDER BY EventDate;
|
||||
|
||||
drop table mutation_delete_null_rows;
|
Loading…
Reference in New Issue
Block a user