Group by
-
Hallo Scott,
I could really use your help, please.
I have a table that contains fields for year, item, a, b, c.
The JSON is exported to a url.
Each line in the table is exported as an array {}
This data needs to be read by another application. In order to do that, I have two options, the first of which would be the neatest.
To use a simplified example:
This is what I get when using SELECT year, item, a, b, c FROM Table.
{1, QWERTY, 10, 10, 20}
{1, ASDFGH, 15, 15, 30}
{2, QWERTY, 5, 5, 8}
{2, ASDFGH, 20, 18, 17}First prize is to GROUP BY year, with the following expected output:
[{1, QWERTY, 10, 10, 20}, {1, ASDFGH, 15, 15, 30}]
[{2, QWERTY, 5, 5, 8}, {2, ASDFGH, 20, 18, 17}]Obviously the output will be nested, that is not a problem ??
Is there any way for me to be able to do this?
Alternatively, I need to count unique items.
When I used SELECT year, count_(year), a, b, c this example would give me a count of 4.
How should I be structuring the query to count unique values?Thank you!! ??
- The topic ‘Group by’ is closed to new replies.