blob: 6d8c66947a8af58a2eb33663e25397642c0d9d72 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
/* postgres can not */
/* multirun can not */
USE plato;
$out = (
SELECT
*
FROM
`Input`
WHERE
value != "111"
);
$row_count = (
SELECT
COUNT(*)
FROM
$out
);
$needed_row = COALESCE(CAST(CAST($row_count as float) * 0.5 as Uint64), 1);
INSERT INTO Output WITH TRUNCATE
SELECT
*
FROM $out ORDER BY key DESC
LIMIT 1 OFFSET $needed_row;
|