#I'm not able to convert SQL query in directus exte...

4 messages · Page 1 of 1 (latest)

green pastureBOT
#

Hey @slow pollen, we've moved your question here. In future, please ask questions in one of the help channels as per the server rules.

Your original message was:
I'm not able to convert SQL query in directus extension GraphQL query.
For example I want to convert this query

SELECT district, MAX(date) FROM wheat GROUP BY district

into GraphQL, I'm trying like this.

    return {
      collection: "wheat",
      query: {
        aggregate: {
          sum: ["date"],
        },
        group: ["district"],
      },
    }

But this give me GraphQL validation error

If there was additional context, @heavy wave will add it here for you. Your original post has been deleted.

#

Thanks for posting! This is a community powered server, so you may or may not get an answer based on available help and expertise. To increase your chances of somebody being able to help you, please make sure your question includes the following:

  • An explanation of exactly what you're trying to achieve.
  • Any and all related code or previous attempts.
  • The exact issue or error you are facing.
  • Any screenshots if applicable.

When you're done with this thread, please close it.

(If you have a support agreement and need help, please contact the core team via email.)

slow pollen
#

@heavy wave can you please let me know how can I do that. There is little typo mistake in my question there should be

query: {
  aggregate: {
    max: ["date"]
  }
}

there should be max instead of sum But nothing is working for me

heavy wave
#

This really isn’t something in my area of knowledge I’m afraid. If and when someone else can help they will. I just moved it to the right place