9951 explained code solutions for 126 technologies


clickhouseAdd row number to results


SELECT rowNumberInAllBlocks(), * FROM tbl;ctrl + c
rowNumberInAllBlocks

returns current row number

FROM tbl

sample table to select data from


Usage example

SELECT rowNumberInAllBlocks(), * FROM tbl
output
┌─rowNumberInAllBlocks()─┬───────date─┬─col────┐
│                      0 │ 2022-01-07 │ Donald │
│                      1 │ 2022-01-10 │ Donald │
│                      2 │ 2022-01-11 │ Donald │
│                      3 │ 2022-01-11 │ Donald │
│                      4 │ 2022-01-12 │ Donald │
...