Querying for median value in LabKey? | olnerdybastid | 2018-04-25 08:47 | |||||||||||||||
Status: Closed | |||||||||||||||||
I am writing a query to summarize some assay results with some very basic statistics (std dev, average, and median). The first two are already taken care of using standard LabKey SQL, but calculating median looks to be a bit more difficult unless I'm overlooking something Our LabKey instance is deployed over Postgres, and I've seen multiple examples of how to do this natively in Postgres (one example here: https://www.periscopedata.com/blog/medians-in-sql). But I don't see anything analogous to to Postgres' ROW_NUMBER() in LabKey SQL, or any way to select an element by its position in a subselect. Is there a way to calculate median in a LabKey SQL query, or has anyone found an acceptable workaround to achieve this? |
|||||||||||||||||
| |||||||||||||||||