How to do a subquery in the FROM clause in cube.js. There is only one table.
SELECT col_a FROM (SELECT col_a, col_b FROM table_name WHERE col_c=some_val ORDER BY time DESC) WHERE col_b=some_other_value
if you are in the same Table you could define a cube.js segment in your schema then specify the segment you are querying in your JSON Query. Refer this page to in the Docs.