| ==== |
| ---- QUERY |
| # multiple levels of aggregation |
| select c1, c3, m2 |
| from ( |
| select c1, c3, max(c2) m2 |
| from ( |
| select c1, c2, c3 |
| from ( |
| select int_col c1, tinyint_col c2, max(id) c3 |
| from alltypessmall |
| group by 1, 2 |
| order by 1,2 |
| limit 5 |
| ) x |
| ) x2 |
| group by c1, c3 |
| limit 10 |
| ) t |
| where c1 > 0 |
| order by 2, 1 desc |
| limit 3 |
| ---- RESULTS |
| 1,96,1 |
| 2,97,2 |
| 3,98,3 |
| ---- TYPES |
| int, int, tinyint |
| ==== |
| ---- QUERY |
| # do not materialize the agg expr slot |
| select c1, c2 |
| from ( |
| select int_col c1, tinyint_col c2, min(float_col) c3 |
| from alltypessmall |
| group by 1, 2 |
| ) x |
| ---- RESULTS |
| 0,0 |
| 1,1 |
| 2,2 |
| 3,3 |
| 4,4 |
| 5,5 |
| 6,6 |
| 7,7 |
| 8,8 |
| 9,9 |
| ---- TYPES |
| int, tinyint |
| |