I am using Hasura and have a table with the following properties:
projects: {
country // string
type // boolean
year // integer
}
What I would like to do is run a query that returns all unique values of each property across all projects. So in the end I have something like:
{ country: "a", country: "b", country: "c" } (... all unique countries)
{ type: true, type: false }
{ year: 2000, year: 2001, year: 2002 } (... all unique years)
I tried the following:
query Test {
projects(distinct_on: [country, type, year] {
country
type
year
}
}
The problem with this is though, I get duplicated values, because it takes the whole set (country, type, year) as a unique value and returns that.
Do I need to alias those requests and run each query alone to really get all unique values, or is there another way?