DEV Community

SPL Open Source Community
SPL Open Source Community

Posted on

SQL, get median of all columns in each row #eg21

In PostgreSQL database, table T has multiple numeric columns:


We want to find the median of all column values in each row. Below is the expected result:


Write the following SPL code:


new()function creates a new two-dimensional table; ~ represents the current record; array() function converts field values of a record to a sequence.

Top comments (1)

Collapse
 
esproc_spl profile image
SPL Open Source Community

SPL open source address:github.com/SPLWare/esProc/stargazers