Bug 6466

Summary: Mode measure
Product: SQL Reporter: Manuel <manuel>
Component: allAssignee: SQL devs <bugs-sql>
Status: NEW ---    
Severity: enhancement    
Priority: Normal    
Version: 11.25.23 (Dec2016-SP5)   
Hardware: Other   
OS: Windows   

Description Manuel 2017-11-13 17:34:34 CET
User-Agent:       Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
Build Identifier: 

It would be nice to have the MODE of a field as a native measure, so that one
will be able to do queries like

SELECT MODE(X), MEDIAN(Y) .... from ... group by ....

Reproducible: Always

Expected Results:  
MODE(X) would return the equivalent of 

select "X" from (select "X", count(1) as "count" from "T0" group by "X") as "T1" order by "count" desc limit 1;

but with the advantage of being able to specify other measures in the same query, and more importantly, being able to use the query with the mode function as a sub-query